NexusFi: Find Your Edge


Home Menu

 





NinjaTrader Mystery - Indicator Changes !


Discussion in Platforms and Indicators

Updated
      Top Posters
    1. looks_one Fat Tails with 3 posts (1 thanks)
    2. looks_two sam028 with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 AlexanderBecker with 1 posts (0 thanks)
    1. trending_up 3,233 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,117

I have a problem with the way the plots are initialized. Here comes a small indicator. Please apply it to a default ES chart and then just follow the instructions.

Any idea, what is wrong?


Attached Files
Elite Membership required to download: Test.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Victory Day Delivers: Russia-Ukraine Ceasefire Market Cl …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
CFTC Rewrites the Rulebook -- Kalshi Cracks $1B Non-Spor …
Prediction Markets & Event Contracts
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
S&P 500 Holds the Line: No Fast Track for SpaceX, Op …
Stocks and ETFs
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Darmok and Jalad at Tanagra
1 thanks
NexusFi site changelog and issues/problem reporting
1 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,757 since Jun 2009
Thanks Given: 3,828
Thanks Received: 4,641


The indicator seems to do what you're asking it to do.
What was your expected result ?


Success requires no deodorant! (Sun Tzu)
Reply With Quote
  #4 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,117


sam028 View Post
The indicator seems to do what you're asking it to do.
What was your expected result ?


My original problem can be better understood with this indicator.

The plot is not re-initializing, when toggling from one instrument to another. I expected that the plot would reinitialize, because it is in the Initialize() section! But toggling does not initialize the plot, because you want to keep the colours and pen properties, so I was trapped.

Apply to any instrument, then toggle between instruments. Plot.Name of first instrument remains active, until you hit FDAX. Then Plot.Name will remain FDAX.


Attached Files
Elite Membership required to download: Test.zip
Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 
AlexanderBecker's Avatar
 AlexanderBecker 
Germany, Karlsruhe
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP
Trading: Futures, EUR.USD
Posts: 1 since Mar 2010
Thanks Given: 1
Thanks Received: 0

Hi.

I have looked at the *zip and the Test.cs of your last post.

If you change your overload of OnStartup like this then the Indicator-Plots' name will be setup with the new instruments' name:

protectedoverridevoid OnStartUp()
{
Plots[0].Name = Instrument.MasterInstrument.Name ==
"FDAX"
? "Hello, I am FDAX"
: string.Format("Hello, I am [{0}]", Instrument.MasterInstrument.Name);
}



Reply With Quote
  #6 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,117


AlexanderBecker View Post
Hi.

I have looked at the *zip and the Test.cs of your last post.

If you change your overload of OnStartup like this then the Indicator-Plots' name will be setup with the new instruments' name:

protectedoverridevoid OnStartUp()
{
Plots[0].Name = Instrument.MasterInstrument.Name ==
"FDAX"
? "Hello, I am FDAX"
: string.Format("Hello, I am [{0}]", Instrument.MasterInstrument.Name);

}



That is correct. The main idea of this thread was to show that an indicator is not reinitialized, if you toggle from one instrument to another, where as OnStartUp() is executed when toggling. Reinitializing is not possible, because you want to keep some of the properties defined, such as the colors of the plot.

So if you initialize the plots by using the name of an instrument, it will stay with the first instrument for ever. Conclusion: You should not use any reference to Instrument.MasterInstrument.Name in the Intialize() section, but do that in OnStartUp().

Your suggestion compensates the error in the Initialize() section, but to code this in a clean way, the error should not be made in the first place!


Started this thread Reply With Quote




Last Updated on October 22, 2010


© 2026 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 - Downloads - Top
no new posts