NexusFi: Find Your Edge


Home Menu

 





How to auto restart running indicator?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Erez with 6 posts (1 thanks)
    2. looks_two Big Mike with 3 posts (4 thanks)
    3. looks_3 Laserdan with 2 posts (3 thanks)
    4. looks_4 Zondor with 2 posts (3 thanks)
      Best Posters
    1. looks_one Zondor with 1.5 thanks per post
    2. looks_two Laserdan with 1.5 thanks per post
    3. looks_3 Big Mike with 1.3 thanks per post
    4. looks_4 trs3042 with 1 thanks per post
    1. trending_up 4,793 views
    2. thumb_up 12 thanks given
    3. group 3 followers
    1. forum 13 posts
    2. attach_file 1 attachments




 
Search this Thread

How to auto restart running indicator?

  #11 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: NinjatraderŽ
Broker: CQG, Kinetick
Trading: Gameplay KlownbineŽ Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,731

Try this. Not guaranteed!

Call a procedure that gets rid of all the existing DataSeries and Plot objects by using the Dispose() method, then calls the Initialize() and OnStartUp() (if used) procedures.

 
Code
private void ResetIndicator()
{
     if(DataSeries1   != null) DataSeries1.Dispose();  // Dispose of all DataSeries objects other than Plots
     if(Values[0]     != null) Values[0].Dispose();       //  Dispose of all Plots

     Initialize();
     OnStartUp()   // only if indicator has an OnStartUp procedure
}

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Tao te Trade: way of the WLD
24 thanks
Just another trading journal: PA, Wyckoff & Trends
23 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #12 (permalink)
 Erez 
Haifa,,,
 
Experience: Intermediate
Platform: NinjaTrader
Broker: CQG
Trading: Futures
Posts: 186 since Mar 2011
Thanks Given: 181
Thanks Received: 869

Thanks @Zondor, assuming this method works, do you know if the indicator will run again through (what I actually need) all the history bars like in "reload ninja script? Or it goes directly to the current bar?



Zondor View Post
Try this. Not guaranteed!

Call a procedure that gets rid of all the existing DataSeries and Plot objects by using the Dispose() method, then calls the Initialize() and OnStartUp() (if used) procedures.

 
Code
private void ResetIndicator()
{
     if(DataSeries1   != null) DataSeries1.Dispose();  // Dispose of all DataSeries objects other than Plots
     if(Values[0]     != null) Values[0].Dispose();       //  Dispose of all Plots
 
     Initialize();
     OnStartUp()   // only if indicator has an OnStartUp procedure
}


Started this thread Reply With Quote
  #13 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: NinjatraderŽ
Broker: CQG, Kinetick
Trading: Gameplay KlownbineŽ Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,731



Quoting 
Thanks @Zondor, assuming this method works, do you know if the indicator will run again through (what I actually need) all the history bars like in "reload ninja script? Or it goes directly to the current bar?

My guess is that if the method I suggested does work, the historical bars will reload. Need to try it and see what happens.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #14 (permalink)
 Erez 
Haifa,,,
 
Experience: Intermediate
Platform: NinjaTrader
Broker: CQG
Trading: Futures
Posts: 186 since Mar 2011
Thanks Given: 181
Thanks Received: 869


Zondor View Post
My guess is that if the method I suggested does work, the historical bars will reload. Need to try it and see what happens.

Thanks, I'll test it.

Started this thread Reply With Quote




Last Updated on February 25, 2012


© 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