How can i check if the last closed trade has been closed by SL or TP?.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Check if last closed trade reached SL or TP
Collapse
X
-
Hello,
One way would be to use the OnExecution override to check which order had last filled.
Based on which order was filled you could get its signal name, or FromEntrySignal name to determine which order was filled and which order this was a stop or target for.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Hello vibarco,
Here is some example code that may help here:
Code:protected override void OnExecution(IExecution execution) { if (execution.Name == "Stop loss") Print(string.Format("{0} - Stop loss was filled", execution.Time)); if (execution.Name == "Profit target") Print(string.Format("{0} - Profit Target was filled", execution.Time)); }
8/17/2015 5:55:00 AM - Profit Target was filled
8/17/2015 7:00:00 AM - Stop loss was filled
8/17/2015 7:27:00 AM - Stop loss was filled
8/17/2015 7:53:00 AM - Profit Target was filledPaul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ttrader23, 05-08-2024, 09:04 AM
|
9 responses
41 views
0 likes
|
Last Post
by ttrader23
Today, 08:29 PM
|
||
Started by ZeroKuhl, Yesterday, 04:31 PM
|
8 responses
43 views
0 likes
|
Last Post
by ZeroKuhl
Today, 07:25 PM
|
||
Started by reynoldsn, Today, 07:04 PM
|
0 responses
8 views
0 likes
|
Last Post
by reynoldsn
Today, 07:04 PM
|
||
Started by puapwr, Today, 06:09 PM
|
0 responses
4 views
0 likes
|
Last Post
by puapwr
Today, 06:09 PM
|
||
Started by franciscog21, Today, 05:27 PM
|
0 responses
13 views
0 likes
|
Last Post
by franciscog21
Today, 05:27 PM
|
Comment