I'm guessing the answer will be no but thought I'd ask anyway: is there a way to set (or modify) the EnterLongLimit() string name after the actual order has been executed?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
EnterLongLimit()
Collapse
X
-
EnterLongLimit()
The EnterLongLimit() order method allows for a string signalName to be set.
I'm guessing the answer will be no but thought I'd ask anyway: is there a way to set (or modify) the EnterLongLimit() string name after the actual order has been executed?Tags: None
-
Hi Patrick,
Thanks for the reply. I had an idea to get the Order ID from OnExecution and use that value in the signal name (for the entry, stop and profit) as a way of tracking trades.
I wanted to do that because I have a strategy where the same condition set generates multiple open trades and I was having trouble implementing a breakeven strategy using BarsSinceEntry....but I since came up with another solution.
I've actually had so much grief with this that I thought I'd post the solution just in case other users are having the same issue. I kind of thought it would be a common thing but I didn't find a similar issue anywhere and so I had to piece together a solution from several different sources.
So I started by using an integer user variable that incremented if my conditions were met and then passed that count into the signal name like so:
The problem with this approach is the count iterates every time the conditions are met, so if the conditions are met on 2 consecutive bars then at BarsSinceEntry() == 1 the count value will be out of sync by 1 and will no longer reference the initial trade from the first bar. I fixed this with a user defined boolean variable:Code:private int count=0; if (//conditions) { count++; EnterLongLimit("Long"+count); } if (BarsSinceEntry()==1) { //execute code }
Now the code syncs the signal names perfectly. If the conditions were met on the second bar it deducts one from the integer value used to reference the signal name (and if not then it doesn't).Code:if (//conditions) { count++; EnterLongLimit("Long"+count); trigger = true; } else { trigger = false } if (trigger = true) { if (BarsSinceEntry("Long"+(count-1)) == 1) { // execute code } } else if (trigger = false) { if (BarsSinceEntry("Long"+count) == 1) { // execute code } }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
599 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
344 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
558 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
557 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment