![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Member
Join Date: Mar 2012
Location: DFW, TX
Posts: 40
Thanks: 3
Thanked 7 times in 4 posts
|
There are times when one of my strategies generates an order that I do not want it to execute.
When I cancel that order, the strategy immediately generates an order to replace it. It seems that the only way around this is to disable the strategy - If I am wrong, I would love to learn how to do what I wish. One of the NT support folks recommended that I look at adding buttons, and directed me to a thread that had some examples. I have had trouble deciphering some of these examples so far. My question is this - has anyone created a button that can disable 1 of the specific strategies that is running. To put it another way, if I have Strat1, Strat2 and Strat3 running, and I wish to block orders from Strat1 without affecting the other two. Ideally, I would like to have 3 buttons on the toolbar that generates a "blocking signal" that I can then add to a strategy. Something like "if button is clicked then a blocking variable is set to TRUE" and the strategy then looks to that variable in its logic as a permissive. Any ideas? |
|
|
|
|
|
#2 | |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi RodS7,
This is what programming is all about and the code you write will ultimately control what happens with your strategy order submission. We would not typically recommend adding buttons as this is more of a broader C# item that we cannot support. It may be useful to have but skirts the issue of writing code that does what you want it to do. Quote:
Let's say you have some conditions for cancelling the order. Consider setting a bool flag here that's also used to control order submission. The last piece is defining a condition when you want to start accepting orders again. The three parts to this would look something like this: Code:
if (cancelCondition)
{
CancelOrder(myOrder);
okToSubmit = false;
}
if (orderSubmissionConditions && okToSubmit)
{
//submit an order here.
}
if (conditionsForResettingFlag)
{
okToSubmit = true;
}
Ryan M
NinjaTrader Customer Service
Last edited by NinjaTrader_RyanM; 06-27-2012 at 01:31 PM.
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Loss of connection preventing any further signals from strategy | JezzaNT | Automated Trading | 5 | 06-04-2012 01:56 PM |
| Orders outside market disabling strategy | taotree | Strategy Development | 4 | 07-01-2011 01:57 PM |
| strategy disabling | nicknamed | Automated Trading | 3 | 01-06-2011 06:41 AM |
| Disabling Strategy when closing position | bstrader | Version 7 Beta General Questions & Bug Reports | 2 | 08-18-2010 06:39 AM |
| Hot keys query and disabling order placement confirmation window. | Scooter1 | Miscellaneous Support | 1 | 02-02-2009 12:31 AM |