Need help with adding Indicator to chart via ToolStrip Button - NinjaTrader Programming | futures io social day trading
futures io futures trading


Need help with adding Indicator to chart via ToolStrip Button
Updated: Views / Replies:913 / 5
Created: by erk707 Attachments:3

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Need help with adding Indicator to chart via ToolStrip Button

  #1 (permalink)
Elite Member
Irvine, CA
 
Futures Experience: Intermediate
Platform: Ninjatrader
Favorite Futures: Piano, ES, GC, CL, NQ, 6E
 
Posts: 21 since Feb 2011
Thanks: 5 given, 4 received

Need help with adding Indicator to chart via ToolStrip Button

Hey guys, I am still on the quest to have a ToolStrip button to be able to add my favor indicator and remove it at will without the hassle of opening the indicators window. I have the code working where it will add the indicator to the chart and remove it via this toolstrip button. I need help from one of the wizards in here to tackle the last part of the problems.

Problem 1 - It the button is clicked and the indicator is showing on the screen and I hit F5 I get one hell of a nasty NT error(See screenshot attached). This only happens if the indicator is added with the button. If it is not on the screen... no issues. My guess is I'm not disposing of this indicator object correctly in OnTermination() or maybe the problem is much bigger. I used Print and VS and I see that OnTermination() is being hit and processed through so i thought I could handle there but it doesn't seem to be working. When I debugged in VS and looked at the callstack (See screenshot) the first error occured in ChartControl.ApplyIndicatorsStrategies() which corresponds to the Ninja Error. This error list is way over my head so I'm looking for the wizards help here.

Problem 2 - If the toolstrip button is pressed and the indicator is showing on the chart and then I go into the Indicators window to manually add another indicator. When I click OK is reloads the chart just fine. I guess not really a problem. Just trying to figure out what is going wrong in reload ninjascript versus the indicator window reloading everything.

If you guys could look at the code and let me know what I am doing wrong i would appreciate it greatly.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Attached Files
Register to download File Type: zip ToolStripButtonADX.zip (2.1 KB, 29 views)
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Heidelberg, Germany
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Stocks
 
Posts: 11 since Jun 2014
Thanks: 6 given, 12 received


no, unfortunately I don't know (didn't find) the answer.

One comment: would recommend that you swap around the Remove(indicator) and then indicator.Dispose calls. Not that it helped in the big picture. Sorry.
 
Code
if (ChartControl!=null) foreach(Indicator indicator in ChartControl.Indicators)
  if (indicator.Name == "ADX")
  {
      ChartControl.Remove(indicator);
      indicator.Dispose();
  }
if (tsrTool!=null && btnIndicator!=null)
  tsrTool.Items.Remove(btnIndicator);

Reply With Quote
 
  #4 (permalink)
Elite Member
Irvine, CA
 
Futures Experience: Intermediate
Platform: Ninjatrader
Favorite Futures: Piano, ES, GC, CL, NQ, 6E
 
Posts: 21 since Feb 2011
Thanks: 5 given, 4 received

I got word back from NT support after i sweet talked them into looking into the problem and there response was that i wasnt releasing the indicator in OnTermination. Im not sure what they mean by that since im removing it from the chart and disposing of it in OnTermination. Im not sure if there is a different method of releasing indicators that anyone knows of.

Reply With Quote
 
  #5 (permalink)
Elite Member
ITAJAI SC/BRAZIL
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Clear Corretora
Favorite Futures: DOLFUT, WINFUT
 
Posts: 184 since Jun 2014
Thanks: 760 given, 132 received

So.. is it working?


erk707 View Post
I got word back from NT support after i sweet talked them into looking into the problem and there response was that i wasnt releasing the indicator in OnTermination. Im not sure what they mean by that since im removing it from the chart and disposing of it in OnTermination. Im not sure if there is a different method of releasing indicators that anyone knows of.

So.. is it working?
I am interested in remove indicator dynamically.. by code.

Reply With Quote
 
  #6 (permalink)
Elite Member
Irvine, CA
 
Futures Experience: Intermediate
Platform: Ninjatrader
Favorite Futures: Piano, ES, GC, CL, NQ, 6E
 
Posts: 21 since Feb 2011
Thanks: 5 given, 4 received

It is with a lot of work around

It does work. The biggest issue you will run into is when you dynamically put the indicator on the chart via code. You can place and remove without issue with the code provided in this post. The issue happens when the indicator is on the screen and F5 is hit to refresh ninjascript or ninjascript is refreshed via toolstrip menus. If you are working on something personal its no big deal you just cant do those things. If you are working on something you are looking to distribute than what I did was the indicator is added to the chart I would record the selected hotkey value for F5 and also refresh historical data. Then I would change the to an OEM default I.E. set them to 255. I also subscribed to the event handlers for toolstrip click, I.E. if a user clicked on refresh ninjascript via the toolstrip menu. Left click on ninjachart. What you have to do with the toolstrip command is quickly remove the indicator from the chart if that is selected before the refresh starts. I was sucessful with the toolstrip but not the F5. I used event handlers for keydown but wasnt fast enough to remove from chart before NT blew up. Your best bet is to overwrite the users hotkeys for F5 and then re-write them when the user pulls your indicator off the chart.

Hope this helps.

Reply With Quote
The following user says Thank You to erk707 for this post:

Reply



futures io > > > > > Need help with adding Indicator to chart via ToolStrip Button

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an indicator to the chat via a custom button erk707 NinjaTrader Programming 1 October 14th, 2014 02:53 AM
Middle Click of Close Button in Chart Trader canthony NinjaTrader Programming 1 April 28th, 2014 08:23 AM
Adding NYSE tick to an ES chart. Help !!!!! druM3 ThinkOrSwim 2 February 16th, 2013 07:39 PM
Chart switching button bluemele NinjaTrader 9 October 20th, 2011 10:05 PM
looking for a quick key strategy button on chart.. budfoxx NinjaTrader Programming 2 April 11th, 2010 03:58 PM


All times are GMT -4. The time now is 05:06 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.10 seconds with 20 queries on phoenix via your IP 54.90.92.204