I'm trying to get my Ninjascript to execute a trade based on the following parameters:
if ((Times[0][0].Date >= new DateTime(2012, 5, 15)) && (Times[0][0].Date <= new DateTime(2012, 9, 21))) { entry6_xr = 5; entry6_daysback = 9; Target = 3100; Stop = 3000; }
This is my default setting and the stop loss method that occurs earlier in the script:
entry6_xr = 5; entry6_daysback = 10; Target = 3100; Stop = 3100; } else if (State == State.Configure) { SetProfitTarget(@"Entry06Long", CalculationMode.Currency, Target); SetStopLoss(@"Entry06Long", CalculationMode.Currency, Stop, false); SetProfitTarget(@"Entry06Short", CalculationMode.Currency, Target); SetStopLoss(@"Entry06Short", CalculationMode.Currency, Stop, false); }
6/11/2012 4:00:00 PM | entry6_daysback: 9 | entry6_xr: 5 | target: 3100 | stop: 3000
6/11/2012 4:00:00 PM Strategy 'Entry06BigRangeBigMo2WF/-1': Entered internal SubmitOrderManaged() method at 6/11/2012 4:00:00 PM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Entry06Short' FromEntrySignal=''
Strategy 'Entry06BigRangeBigMo2WF/-1': Stop/target handling set to 'By strategy position' since currency based stop order was placed.
6/12/2012 4:00:00 PM | entry6_daysback: 9 | entry6_xr: 5 | target: 3100 | stop: 3000
6/13/2012 4:00:00 PM | entry6_daysback: 9 | entry6_xr: 5 | target: 3100 | stop: 3000
6/13/2012 4:00:00 PM Strategy 'Entry06BigRangeBigMo2WF/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00002-54429' account='Backtest' name='Profit target' orderState=Working instrument='CL 10-21' orderAction=BuyToCover orderType='Limit' limitPrice=108.77 stopPrice=0 quantity=1 tif=Gtc oco='NT-00000-54429' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2012-06-11 16:00:00' gtd='2099-12-01' statementDate='2021-09-14'
6/13/2012 4:00:00 PM Strategy 'Entry06BigRangeBigMo2WF/-1': Cancelled OCO paired order: BarsInProgress=0, orderId='NT-00002-54429' account='Backtest' name='Profit target' orderState=Cancelled instrument='CL 10-21' orderAction=BuyToCover orderType='Limit' limitPrice=108.77 stopPrice=0 quantity=1 tif=Gtc oco='NT-00000-54429' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2012-06-11 16:00:00' gtd='2099-12-01' statementDate='2021-09-14'
6/14/2012 4:00:00 PM | entry6_daysback: 9 | entry6_xr: 5 | target: 3100 | stop: 3000
How can I get the trades to execute according to my first set time based parameters shown above?
Thanks,
Ben
Comment