I can't understand what is wrong and is very hard for me to debug with the live account because I need to manage my position. I'm not using any copier, nor I'm having more than one instance of this strategy running at the same time.
I only enter the position when it is flat.
This is the code I'm using to enter the position:
if (Position.MarketPosition == MarketPosition.Flat) { if (CrossAbove(EMA_Low, EMA_High, 3) { SetStopLoss(@"Long", CalculationMode.Ticks, StopLoss, false); SetProfitTarget("Long", CalculationMode.Ticks, TargetTicks); EnterLong(Qty, @"Long"); } }
Qty is 1 and EntriesPerDirection is set 3.
To be honest, I'm not sure if it's doubling up or entering 1 more contract, because I'm usually take 1 contract, but the order is executed twice and end up with 2 contracts.
Again, in sim mode, everything works fine. The problem is in the live account.
The log shows two different executions:
Order='69274400291/8127836' Name='Long Copied' New state='Submitted' Instrument='NQ 06-24' Action='Buy' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='e5a9a72f25954eb99799e587e0312936' Filled=0 Fill price=0 Error='No error' Native error=''
Order='69274400291/8127836' Name='Long Copied' New state='Working' Instrument='NQ 06-24' Action='Buy' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='e5a9a72f25954eb99799e587e0312936' Filled=0 Fill price=0 Error='No error' Native error=''
Order='69274400291/8127836' Name='Long Copied' New state='Accepted' Instrument='NQ 06-24' Action='Buy' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='e5a9a72f25954eb99799e587e0312936' Filled=0 Fill price=0 Error='No error' Native error=''
Execution='68921980094_1' Instrument='NQ 06-24' Account='8093601' Exchange=Default Price=17736.75 Quantity=1 Market position=Long Operation=Operation_Add Order='68921980094' Time='4/24/2024 9:35 AM'
Instrument='NQ 06-24' Account='8093601' Average price=17736.75 Quantity=1 Market position=Long Operation=Operation_Add
NinjaScript strategy 'EMA Strategy V1.3/305394201' submitting order
Order='68921980094/8093601' Name='Long' New state='Filled' Instrument='NQ 06-24' Action='Buy' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=1 Fill price=17736.75 Error='No error' Native error=''
Order='68921980094/8093601' Name='Long' New state='Submitted' Instrument='NQ 06-24' Action='Buy' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='68921980094/8093601' Name='Long' New state='Working' Instrument='NQ 06-24' Action='Buy' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='68921980094/8093601' Name='Long' New state='Accepted' Instrument='NQ 06-24' Action='Buy' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
NinjaScript strategy 'EMA Strategy V1.3/305394201' submitting order
Any ideas?
Comment