Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Move to breakeven
Collapse
X
-
Null
I tried commenting out the null setting in OnPositionUpdate() but the following Print() isnt fired in the OnOrderUpdate:
if(LongStopGem != null)
{
if(LongStopGem.Token == order.Token)
{
Print("Order is " + order.ToString() + " \n");
}
}
Similar for OnExecution.
Using:
SetStopLoss("LongEntryGem",CalculationMode.Price,Position.AvgPrice+TickSize* commission,true);
Instead of:
LongStopGem = ExitLongStop(Position.AvgPrice+TickSize*commission ,"LongStopGem","LongEntryGem");
Does seem to move the stop loss correctly as this is output in the orders/executions however the first method provides a reference to the IOrder object and therefore should actually be more robust. I have just tried putting a try/catch around LongStopGem = ExitLongStop... but the Print() statement in the catch isnt fired. Its appears that this line is ignored completely.
Comment
-
mballagan,
Please just post the script as a whole piece. You are likely resetting it too early or something along those lines.
The way it works is very simple.
Variables
OnBarUpdate()Code:private IOrder someOrder = null;
OnOrderUpdate()Code:someOrder = EnterLong();
Code:if (someOrder != null && someOrder.Token == order.Token) // Do something;
Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
52 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
16 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
23 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
24 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment