View Full Version : Run only once
BradB
01-18-2007, 03:54 AM
Is it possible to have a strategy only allow an order to be placed once per day (from that strategy...)? In other words, if the strategy conditions were met and an order was placed, no other orders would be placed by this strategy for the remainder of the trading session.
NinjaTrader_Ray
01-18-2007, 04:07 AM
There are no NinjaScript methods or UI options to control this however, you can do that programatically.
Ray
BradB
01-18-2007, 04:11 AM
That's what I'm looking for, how/what can I check that would tell me if THIS strategy had opened an order already that trading session? Even if it had met it's target and was now closed...
NinjaTrader_Ray
01-18-2007, 04:19 AM
Try something like:
private bool orderPlaced = false;
protected override void OnBarUpdate()
{
// Reseton newday
if (Bars.DayBreak)
orderPlaced = false;
if (orderPlaced == fase&& yourCondition == true)
{
EnterLong();
orderPlaced = true;
}
}
Ray
BradB
01-18-2007, 04:21 AM
Makes sense...thanks Ray.