Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Print Statement out of SetStopLoss and SetProfitTarget
Collapse
X
-
Print Statement out of SetStopLoss and SetProfitTarget
When using print statement in a strategy, how do I get the output to show time of execution of the trade, price, and if I'm using SetStopLoss and SetProfitTarget, to show the exit of the trade as well?
Thanks.Last edited by AdeptistJune; 01-11-2022, 03:39 PM.Tags: None
-
Hello AdeptistJune,
You would need to use a manually coded strategy and OnExecutionUpdate.
You can filter for orders by looking for orders with specific names, for the set methods you can view the order names in the control center to see how they are spelled for those type of targets.
-
Hello Jesse,
I'm having a hard time understanding. Can you provide a sample code snippet? Thanks.
Comment
-
Hello AdeptistJune,
In your strategy you would need to add the OnExecutionUpdate override, that is shown in the help guide:
After adding that to the strategy you could observe any fills related to that specific strategy using the execution object as shown above. To print the time you would do:Code:protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time) { Print(execution.ToString()); }
Code:Print(execution.Time);
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
63 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
35 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
198 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
364 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
283 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment