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,320 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 ?

  #1 (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

hi coders !

i have attached 2 indicators that are not very different in what they do.
also its nearly the same plots + code-lines.
but their loading-time very very differently when ading them in a chart.

my question is : Why is this VolatilityStop- indicator loading so slowly with high CPU-usage ?

i cant find the reason in the code by myself - but i would love to find it out

any ideas ?

also a question : will this "loading so slowly" eat more recources in realtime-action than a fast loading one when i use the indicator in a strategy ?
or do you think its only the first initial loading that takes so much time + cpupower ?

special Qs for special guys i think

looking forward to intersting ideas !

VolatilityStop = slow loading
ATR-Trailer = fast loading

BTW - thats all NT6,5 stuff.

.

max-td
Attached Files
Elite Membership required to download: VolatilityStop.cs
Elite Membership required to download: ATRTrailing.cs
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
 
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?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #3 (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


Easy answer:

The two indicators are coded in a different way!



If this answer did not help you, you need to check the code in lines 81 and 102 of the volatilitystop indicator. "counter" may take a higher value than "period" as used by ATRTrailing. The MAX and MIN methods are the public servants of the NinjaTrader methods, they are executing the job you ask, but slowly.

Reply With Quote
Thanked by:
  #4 (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

hmmm

---

max-td
Started this thread Reply With Quote
  #5 (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

that would mean you think its mainly caused from this different :


SigClose = MIN (Low, (period)) [0] ;


against


SignalClose = MIN (Close, (counter)) [0] ;



where period is a fixed variable
and
counter is a variable that is calculated new each time

max-td
Started this thread Reply With Quote
Thanked by:
  #6 (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

BINGO !

thats really the point !

i changed counter in this - SignalClose = MIN (Close, (counter)) [0] ; and in the visaversa-line --
into a static variable for testing and it loads fast as hell

for shure it plots an other line too - but that wasnt the question now.

ok - thanks a bunch for the input!

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 ?

max-td
Started this thread Reply With Quote
  #7 (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

I think the main point is that counter can take much larger values than period. I do not think that the access of a dynamically defined variable is slower than the access of a static variable. You could try to substitute counter with a large fixed number and see what happens.

Reply With Quote
  #8 (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

hmm
as i see it in the code , counter is only set to 0 / 1 / 2 -- depending on conditions - not more.


and if i insert 150 as fix number - loads fast as hell too.

max-td
Started this thread Reply With Quote
Thanked by:
  #9 (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
hmm
as i see it in the code , counter is only set to 0 / 1 / 2 -- depending on conditions - not more.


and if i insert 150 as fix number - loads fast as hell too.


Interesting, learned something.

Reply With Quote
  #10 (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


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 ?

max-td
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