Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Mutiple Position exit question
Collapse
X
-
Comment
-
edgleliner, either submit the exits in the same manner in which you submitted entries (BarsInPogress check) or explicitly state to which Barsr object to execute to in your ExitLong / ExitShort call -
ExitLong(int barsInProgressIndex, int quantity,string signalName,string fromEntrySignal)
ExitShort(int barsInProgressIndex, int quantity,string signalName,string fromEntrySignal)
Comment
-
This is what I get in the output window when the EUR/USD is down $4 and the GBP/USD is down $3
EUR/USD is at -3.99999999999956
GBP/USD is at 0.99999999999989
Total Profit/Loss is -2.99999999999967
here is what I get when the EUR/USD is down $5 and GBP/USD was down $4
EUR/USD is at -4.99999999999945
GBP/USD is at 0
Total Profit/Loss is -4.99999999999945
GBP/USD was down $6 when I cut and pasted this.....
EUR/USD is at -5.99999999999934
GBP/USD is at 2.000000000002
Total Profit/Loss is -3.99999999999734
Why is the EUR/USD working great, but not the GBP/USD?????
Comment
-
Could you be more specific??Originally posted by NinjaTrader_Bertrand View Postedgleliner, either submit the exits in the same manner in which you submitted entries (BarsInPogress check) or explicitly state to which Barsr object to execute to in your ExitLong / ExitShort call -
ExitLong(int barsInProgressIndex, int quantity,string signalName,string fromEntrySignal)
ExitShort(int barsInProgressIndex, int quantity,string signalName,string fromEntrySignal)
Comment
-
edgleliner, unfortunately we don't have the bandwith to code out your full script for you - you would need to use the provided overloads that allow for the BarsInProgress parameter so that an exit order is submitted to both of your symbols.
Both seems to be working on my end, remember one is updated on each tick, as you add a 1 tick stream.
Comment
-
I am not sure what you are suggesting???? I don't know how it could be working on your end and not mine???? I do not want to give up on this system as I feel it has a lot of potential with other currencies as well. It is really important to me that I get this base one working, so that I can expand it to the final one(s) that I have in mind. I feel others in this forum will benefit from this once I get it going. Let me know your thoughts........
Comment
-
edgeliner, to get your idea working I suggested using the more advanced ExitLong and ExitShort call, that allows you to specify which barsobject to exit, thus both positions are exited as you would like to, not only the primary EURUSD one. You would need the calls I posted in my prior post, where the first paramter is the barsinprogress input.
Comment
-
Could you show me a specific example?Originally posted by NinjaTrader_Bertrand View Postedgeliner, to get your idea working I suggested using the more advanced ExitLong and ExitShort call, that allows you to specify which barsobject to exit, thus both positions are exited as you would like to, not only the primary EURUSD one. You would need the calls I posted in my prior post, where the first paramter is the barsinprogress input.
Comment
-
NinjaTrader_Josh not clear at all sorry...
Hello NinjaTrader_Josh,
This concept is very important to understand as it is at the core of everything, not sure why there is not more info on it. For the life of me can not figure out whats going on.... the following code does not seem to clear the longs.
This code is in the inner set of bars .....
if (GetCurrentBid() < Variable1 && GetCurrentBid() < Variable0 - (TrailStop * TickSize) && Variable2 == 1)
{
ExitLong(1, (DefaultQuantity / 2), "", "LongDouble");
ExitLong(1, (DefaultQuantity / 2), "", "LongStart");
Variable2 = 3; // Double down not in effect, wait for new entry to start again
Print("Exit Double Long stopped out: "+ GetCurrentBid());
}
Comment
-
Bluepoint, it is hard to comment on that particular piece of code without knowing how the rest of your strategy is set up.
If you're sure the code block is executing (does the output window print "exit double long..."?) then I'm guessing that you'll want to change the 1's to 0's for the BarsInProgress index, unless this is a multi-instrument strategy and you seek to exit the long positions for the secondary instrument in which case this code will not help:
Code:ExitLong(0, (DefaultQuantity / 2), "", "LongDouble"); ExitLong(0, (DefaultQuantity / 2), "", "LongStart");
AustinNinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
650 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment