I place orders with an indicator (not in a strategy).To cancel the last order I use a shortcut from the hotkey manager.
I would like to do this with a button in the toolbar that I use to clear pending stuff from the last order. Is there a way to program this command (not the button), or to simulate the shortcut (Ctrl+Alt+Escape) without pushing the keys?
Yes, it is possible to create a toolbar button to clear a pending order. But only if it is a strategy.
Yes, it is possible to use third party programs like AutoHotKey to issue 'commands' to NinjaTrader through keyboard shortcuts.
If I have misunderstood, please restate the question and hopefully someone else can also help you.
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.
Sorry for being not so clear. English is my third language…
I plan the trade with entry, stop, targets, MM etc. and some programmed limiting choices by the entry part of my trading plan with this tool. And if OK, push the button. I call it discretionary trading with training wheels. And its an indicator.
As you see on the picture, I have an entry order at the exchange that was sent by clicking the button and two oco orders (generated by that clicking) that are in my computer (and will go to the exchange when entry price is touched).
To cancel this stuff I have to cancel the order and the pending orders in my system. And I want to do this with one click at the clear button, to keep things KIS(S).
Object reference not set to an instance of an object
My indicator is based on your code. Entry, stop, targets, oco. Everything is possible that way. To plan and enter a trade much more flexible (and visible on the chart, while planing) than ATM. After entry you can even use the breakeven position by using the hotkey code to automate this.
One little problem with your indicator (and mine too): When loading (or reload with F5) or changing time frame with charttrader enabled but closed, I have an error:
Error on calling 'OnStartUp' method for indicator 'ChartTraderIndicator': Object reference not set to an instance of an object.
When changing timeframe etc. with charttrader open, then there are no errors. It's a problem I can live with, but if you see a solution...
may be its the ChartTraderControl which is not initialized (it has a private constructor) etc. maybe you should bug fix it with try catch. alternative would be placing the buttons on the toolstrip or the chart panel itself.
with the code i just provided an example (for submitting orders via indicators) which can be taken as a reference point.