I am trying to work out why my script applies a shared stop loss and profit target instead of having it uniquely applied to each order. Would love to have your insight.
Example of the case I am trying to solve:
In this example I set my profit target to be $250. LongEntry_170 gains $100 whereas LongEntry_171 gains $150. Combined this results in a gain of $250. However, my goal is for each trade to individually target $250.
Here is a code snippet.
if (longEntryConditionsAreMet()) {
longTradeCount++;
string longEntryName = "LongEntry_" + longTradeCount; // Unique name for each long entry order
// Place long order with unique name
EnterLong(longEntryName);
// Set stop-loss and profit target for the trade
SetStopLoss(longEntryName, CalculationMode.Currency, StopLoss, false);
SetProfitTarget(longEntryName, CalculationMode.Currency, ProfitTarget);
}
Entry Handling -> Unique
Entry Handling -> All
Thank you for taking the time to read my post. Looking forward to hearing some feedback.
-Gustav

Comment