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 Quick Summary with 1 posts (0 thanks)
    3. looks_3 AlexanderBecker with 1 posts (0 thanks)
    4. looks_4 sam028 with 1 posts (0 thanks)
    1. trending_up 3,157 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
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,114

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?
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Zytrade: Devin Brady, CEO - Ask Me Anything (AMA)
Brokers
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,756 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,632


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


Success requires no deodorant! (Sun Tzu)
Follow me on X Reply With Quote
  #4 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
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,114


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
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,114


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