NexusFi: Find Your Edge


Home Menu

 





Why is this indicator loading so slowly ?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one max-td with 10 posts (2 thanks)
    2. looks_two Fat Tails with 5 posts (4 thanks)
    3. looks_3 Jura with 2 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 7,325 views
    2. thumb_up 7 thanks given
    3. group 3 followers
    1. forum 17 posts
    2. attach_file 9 attachments




 
Search this Thread

Why is this indicator loading so slowly ?

  #11 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


max-td View Post
any ideas ?

I am . Have no at all.

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #12 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


max-td View Post
hehe me too !

i dont have to find out the deeper why now ... but this i like to get answered if possible :

so my second question was if this indicator makes also a strategy permanently more heavy than a fast loading one while running realtime ?
or does this only affect the loading-process ?

any ideas ?

I don't know if it's relevant to this discussion, but Visual Studio can profile code for an more advanced analysis of an indicator.

See the wiki post How-to profile [AUTOLINK]NinjaTrader[/AUTOLINK] code with Visual Studio 2010 - Big Mike's Day Trading Forum

Or am I missing the point? In that case, sorry.

Reply With Quote
  #13 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


sounds like a good idea Jura !

maybe i should have a look at this one winter-day
but i do not even have this VS at the moment.

is it free available ? - ok - wrong question - its nothing free i saw in the wiki-post

max-td
Started this thread Reply With Quote
  #14 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


max-td View Post
sounds like a good idea Jura !

maybe i should have a look at this one winter-day
but i do not even have this VS at the moment.

is it free available ? - ok - wrong question - its nothing free i saw in the wiki-post

Well, the Express Edition of Visual Studio is free available (after registration), but (as far as I know) that version doesn't support the 'performance profiling'.

I'm not an Visual Studio expert (not even an intermediate user lol) but I looked at your question. If I understand it correctly, you where wondering if the strategy would be an continuous drag on a system resources?

Because I don't have your strategy (or settings for that matter), I did the following in NinjaTrader while Visual Studio was profiling in the background:
1. Started up NinjaTrader 7.0.0.20 (empty workspace),
2. Opened a 5 minute chart (with 30 days of data),
3. Connected to Interactive Brokers,
4. Let the chart update in real-time for a few minutes,
5. Added multiple indicators (with CalculateOnBarClose on false),
6. Let the chart and it's indicators update in real-time for a few minutes,
7. Exited NinjaTrader.

The idea was that, if multiple indicators lead to higher CPU usage, you would see an higher level of CPU usage after adding the indicators than you saw before adding the indicators. Please see the screen with the CPU chart from Visual Studio: I can't see any noteworthy higher CPU usage after adding of the indicator. I've also added a chart which shows wich indicators I put on the real-time chart.

But I do not know how to read the various processes as is demonstrated in the wiki article, so perhaps these findings are biased or so.

Perhaps @MXASJ or @gomi can provide some useful insights.

Regards,

Attached Thumbnails
Click image for larger version

Name:	chart.png
Views:	209
Size:	83.2 KB
ID:	19891   Click image for larger version

Name:	lines.png
Views:	198
Size:	187.8 KB
ID:	19892   Click image for larger version

Name:	VSoutput1.png
Views:	200
Size:	108.9 KB
ID:	19893  
Reply With Quote
Thanked by:
  #15 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

wow !
so you have the full VS it seems.

for me it was more a basic question if this indicator (VolatilityStop from below) would use the high loading- (initialize-) power also in permanently running stat in strategy usage.
because i am not shure WHY its using so long loadingtime.
just to understand a bit more of those coding-stuff.

MXA says this :
I have strats that take about 10 seconds to initialize, but then consume very liitle.

so i think that answers also for my Q : it may be the initializing process only. - but its not tested yet.

if you like to ad the VolatilityStop (see in the first post) in your testing-setup + watch whats going on - that would be interesting!

maybe i do a small strategy with the VolatilityStop later to also test it with strategy running.
well - if YOU are willing to do more tests ! -- i dont have VS on my end ... mxa also not - he has only a small version.

testing could be done with pressing F5 to reload all the stuff in the chart.
it can be cpompared with having one chart with those several indicators in + press F5
and having another chart with tose several indis PLUS the vola-stop in ther + press F5
and watch the graohs --- just as idea

max-td
Started this thread Reply With Quote
  #16 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

There are specific NinjaTrader methods that cause problems with CPU usage

(1) The worst problem is caused by custom plots that execute heavy calculations. The reason is that the plot is recalculated for every incoming tick, even if an indicator is set to CalculateOnBarClose = true; Proper coding with NInjaTrader requires that custom plots are kept as slim as possible.

(2) Some of the Draw() Methods of NinjaTrader are badly implemented, so you need to reduce the lookback period of any indicator that draws on the chart. I have had huge problems with DrawRectangle(), DrawDiamond() and DrawArrowUp() etc. To reduce the lookback period of the indicator, you can just add a line to check for the date.

(3) Some of the other methods such as MAX() ,MIN() also cause problems.

(4) You can reduce the CPU load by putting some of the indicator code into a bracket after FirstTickOfBar

 
Code
 
if (FirstTickOfBar)
{
 
// enter code here that only needs to be excuted once for each bar, so the calculations will not be performed with every incoming tick...
 
}
These are the principal case that I have encountered. Of course you can use the sophisiticated methods of Zondor to further speed up your code.

Reply With Quote
Thanked by:
  #17 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

yes fattails,
but we started with the 2 given indicators in post 1 - they are nearly the same but so different in loading-time+recources.

i dont want to explore all Ninja-deepness about this -- just still to looking at this VolatilityStop.

maybe in this direction the VS-testing bring us a bit more details in this special case - that was the idea now.

max-td
Started this thread Reply With Quote
  #18 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

OK - i made some simple strats with the indicator for testing :

it plosts 2 arrow if we have a cross of the Close above / below the VolaStop


- ____Vola_Bucks_02.cs = incl. the Original VolatilityStop + NO ploting

- ____Vola_Bucks_01_Plus_Plot.cs = incl. the Original VolatilityStop AND ploting on the chart


- ____Vola_Bucks_01_Minus_Count..cs = incl. the fast variation of the VolaStop - inpired by Fat Tails ideas - for testings only - + NO ploting on the chart


- VolatilityStop_Test_Tails.cs = here i replaced the variable "counter" in the MAX / MIN - calculations with a fix variable and it loads superfast now + used it in the strategy ____Vola_Bucks_01_Minus_Count..cs


The idea was if the strategys are very different compared to eachother in

1 - loading
2 - during live-running

looking at cpu-usage + analyses in VS

and if its possible to see wich section is responsible for this. ( hot lines or so ... )

as said Jura or other VS-owners , if you have fun with doing this or find it useful somehow.

max-td
Attached Files
Elite Membership required to download: ____Vola_Bucks_02.cs
Elite Membership required to download: ____Vola_Bucks_01_Plus_Plot.cs
Elite Membership required to download: ____Vola_Bucks_01_Minus_Count.cs
Elite Membership required to download: VolatilityStop_Test_Tails.cs
Started this thread Reply With Quote




Last Updated on September 9, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts