NexusFi: Find Your Edge


Home Menu

 





Question on ChartControl and custom buttons


Discussion in NinjaTrader

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




 
Search this Thread

Question on ChartControl and custom buttons

  #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?
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Strategy stop orders partially filled
EasyLanguage Programming
Cheap historycal L1 data for stocks
Stocks and ETFs
 




Last Updated on October 16, 2014


© 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