I believe Ninjascript is not considering stop or limit prices when calling ExitLongStopLimit.
I search around and havent found anybody talking about it (therefore i must be missing something here ... ), I have came up with a strategy script which uses something like the command below
ExitLongStopLimit(BarsInProgress, true, 1, 1.0032, 1.0033, "ExitLong", "EnterLong");
I print out a few info on every ticket and place some of the output below
Line 01: Bar: 2231 Tick: 1/4 Close[0]: 1.0034 Line 02: Bar: 2232 Tick: 2/4 Close[0]: 1.0034 Line 03: Bar: 2232 Tick: 3/4 Close[0]: 1.0034 Line 04: Bar: 2232 Tick: 4/4 Close[0]: 1.0034 Line 05: \- ExitLongStopLimit Bar: 2233 Stop: 1.0033 Limit: 1.0032 Close[0]: 1.0034 Line 06: OnOrderUpdate Order='5c4af500d3c24a29abe0e7ac93fe0251/Sim101' Name='ExitLong' State=PendingSubmit Instrument='$AUDUSD' Action=Sell Limit price=1.0032 Stop price=1.0033 Quantity=1 Type=StopLimit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='5c4af500d3c24a29abe0e7ac93fe0251' Gtd='1/1/0001 12:00:00 AM' Line 07: OnOrderUpdate Order='5c4af500d3c24a29abe0e7ac93fe0251/Sim101' Name='ExitLong' State=Accepted Instrument='$AUDUSD' Action=Sell Limit price=1.0032 Stop price=1.0033 Quantity=1 Type=StopLimit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='5c4af500d3c24a29abe0e7ac93fe0251' Gtd='1/1/0001 12:00:00 AM' Line 08: Bar: 2232 Tick: 1/4 Close[0]: 1.0034 Line 09: OnOrderUpdate Order='5c4af500d3c24a29abe0e7ac93fe0251/Sim101' Name='ExitLong' State=Working Instrument='$AUDUSD' Action=Sell Limit price=1.0032 Stop price=1.0033 Quantity=1 Type=StopLimit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='5c4af500d3c24a29abe0e7ac93fe0251' Gtd='1/1/0001 12:00:00 AM' Line 10: Bar: 2233 Tick: 2/4 Close[0]: 1.0034 Line 11: OnOrderUpdate Order='5c4af500d3c24a29abe0e7ac93fe0251/Sim101' Name='ExitLong' State=Filled Instrument='$AUDUSD' Action=Sell Limit price=1.0032 Stop price=1.0033 Quantity=1 Type=StopLimit Tif=Gtc OverFill=False Oco='' Filled=1 Fill price=1.0034 Token='5c4af500d3c24a29abe0e7ac93fe0251' Gtd='1/1/0001 12:00:00 AM' Line 12: Bar: 2233 Tick: 3/4 Close[0]: 1.0034 Line 13: Bar: 2233 Tick: 4/4 Close[0]: 1.0035
- If I pass stop=1.0033 and Limit=1.0032 why does the order was filled with the price at $1.0034?
- Lets say the market reaches $1.0033, trigged the stop and was up to $1.0034 in the next ticket (which by the way was me) therefor i got $1.0034, why them have I not receive the $1.0033 ticket info (I set the print to the first line on the OnBarUpdate with "CalculateOnBarClose = false;")?
And the real question, "what am I missing?".
Thanks,
Comment