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 md4866, 05-01-2024, 08:15 PM
|
2 responses
17 views
0 likes
|
Last Post
by md4866
Today, 12:33 PM
|
||
Started by samish18, Today, 12:20 PM
|
0 responses
6 views
0 likes
|
Last Post
by samish18
Today, 12:20 PM
|
||
Started by thread, 04-15-2024, 11:58 PM
|
3 responses
48 views
0 likes
|
Last Post
by Georg1o
Today, 12:05 PM
|
||
Started by leojimenezp, 04-20-2024, 05:49 PM
|
4 responses
49 views
0 likes
|
Last Post
by leojimenezp
Today, 11:49 AM
|
||
Started by nicthe, Today, 09:24 AM
|
1 response
6 views
0 likes
|
Last Post
by nicthe
Today, 10:57 AM
|
Comment