I am using ExitLongStopMarket() to move the StopLoss in a trade. I am facing an issue when I move the StopLoss. The original StopLoss order stays put and doesn't cancel. I am modifying the order object. This happens only If I modify the Stop Signal name. If I keep the same Signal name in the order it works fine. I need to use a different signal name to make tracking my orders better. Is there any way to fix the issue.
When I change the signal name, Is it not modifying the same order object? It appears If I change the Quantity/Price and keep the Signal name and FromEntrySignal the order object is modified but If I change the StopLoss signal name then the original order object stays the same and a new StopLoss order is created.
See below the log:
===========
Now the interesting thing is If I do not change the name Name but keep it the same and update the StopLoss price.
Then it is working as expected. The StopLoss is moved correctly
===========
===========
Now the interesting thing is If I do not change the name Name but keep it the same and update the StopLoss price.
Then it is working as expected. The StopLoss is moved correctly
===========
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Working' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.7013 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Accepted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.7013 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Change submitted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.7013 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Working' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.7021 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Accepted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.7021 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Change submitted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.7021 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Working' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70228 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Accepted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70228 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Change submitted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70228 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Working' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70259 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Accepted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70259 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636364144/ACCOUNT' Name='StopShort STB1' New state='Submitted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70259 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
=====
I modified the StopLoss to give the trade little bit of breathing room
Here I changed the StopLoss name to "StopShort STB1"
Now the effect is , The Original StopLoss as well as the New StopLoss are there in Working State" I am expecting the Original Stop Loss to be replaced with the New StopLoss Order
==========
NinjaScript strategy 'Ninja8STRX/131611074' submitting order
Order='636340689/ACCOUNT' Name='TargetShort' New state='Working' Instrument='NZDUSD' Action='Buy to cover' Limit price=0.67365 Stop price=0 Quantity=14,000 Type='Limit' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636340689/ACCOUNT' Name='TargetShort' New state='Accepted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0.67365 Stop price=0 Quantity=14,000 Type='Limit' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636340689/ACCOUNT' Name='TargetShort' New state='Submitted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0.67365 Stop price=0 Quantity=14,000 Type='Limit' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636340685/ACCOUNT' Name='StopShort Init' New state='Working' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70265 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636340685/ACCOUNT' Name='StopShort Init' New state='Accepted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70265 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636340685/ACCOUNT' Name='StopShort Init' New state='Submitted' Instrument='NZDUSD' Action='Buy to cover' Limit price=0 Stop price=0.70265 Quantity=14,000 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
=====
My Initial StopLoss Order is called = "StopShort Init"
====
Instrument='NZDUSD' Account='ACCOUNT' Average price=0.69865 Quantity=14,000 Market position=Short Operation=Operation_Add
NinjaScript strategy 'Ninja8STRX/131611074' submitting order
Execution='636340684' Instrument='NZDUSD' Account='ACCOUNT' Exchange=Default Price=0.69865 Quantity=14,000 Market position=Short Operation=Operation_Add Order='636340684' Time='6/1/2018 01:30'
NinjaScript strategy 'Ninja8STRX/131611074' submitting order
Order='636340684/ACCOUNT' Name='ShortSTRXBig' New state='Filled' Instrument='NZDUSD' Action='Sell short' Limit price=0 Stop price=0 Quantity=14,000 Type='Market' Time in force=GTC Oco='' Filled=14000 Fill price=0.69865 Error='No error' Native error=''
Order='636340684/ACCOUNT' Name='ShortSTRXBig' New state='Working' Instrument='NZDUSD' Action='Sell short' Limit price=0 Stop price=0 Quantity=14,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636340684/ACCOUNT' Name='ShortSTRXBig' New state='Submitted' Instrument='NZDUSD' Action='Sell short' Limit price=0 Stop price=0 Quantity=14,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
Order='636340684/ACCOUNT' Name='ShortSTRXBig' New state='Accepted' Instrument='NZDUSD' Action='Sell short' Limit price=0 Stop price=0 Quantity=14,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
NinjaScript strategy 'Ninja8STRX/131611074' submitting order
Enabling NinjaScript strategy 'Ninja8STRX/131611074' : On starting a real-time strategy - StartBehavior=AdoptAccountPosition AccountPosition=NZDUSD 14000L, NZDUSD 14000L EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=Per entry execution ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=False SetOrderQuantityBy=Strategy ConnectionLossHandling=Keep running DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
=============
Character limit doesn't allow me to input the code snippet into this message.
I will add it as the replay to this thread.
Comment