NexusFi: Find Your Edge


Home Menu

 





Question on ChartControl and custom buttons


Discussion in NinjaTrader

Updated
    1. trending_up 2,091 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 erk707 
Irvine, CA
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Piano, ES, GC, CL, NQ, 6E
Posts: 21 since Feb 2011
Thanks Given: 5
Thanks Received: 4

Hello guys,

I have what’s naturally an unsupported question for ninjatrader but would like to see if I can get some input from you guys. I have a strategy that has a custom button on it and this custom button when clicked adds an indicator to the chart. I was able to achieve this by using the following code in OnStartUp() in the strategy.

Indicatorbase indicatorTemplate = new ADX(13);
indicatorTemplate.Panel = 1;

Then in the event Handler for by button click I do something like this.

ChartControl.Add(indicatorTemplate);

This part works fine and it adds the indicator to the chart in panel 1.

The problem I run into is when I want to remove the indicator from the chart.

If I call

ChartControl.Remove(indicatorTemplate);

Nothing happens. If I click the button again then it adds another copy of ADX(13) to the 1st panel. If I close the chart nothing happens. If I reload Ninjascript it throws this nasty NT7 error saying I broke everything.

It seems it should work. The only thing I can see that is different between Add and Remove is the following

Add give this in intellisense (IndicatorBase indicatorTemplate)
While Remove gives this (IndicatorBase indicator)

Any help would be much appreciated.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Daytrading to swingtrading
Traders Hideout
No book, only a stair: journaling fills where price move …
Cryptocurrency
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Want your NinjaTrader indicator created, free?
5 thanks
Afternoon-close session
1 thanks
Franks Trading Journey
1 thanks
Denied 20K payouts: Alpha Futures
1 thanks
FootPrintV2 Chart for NT8
1 thanks




Last Updated on October 16, 2014


© 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