I have a strategy (see attached file) with 2 different entry signal names, and my goal is to use "SetStopLoss" and "SetProfitTarget" with CalculationMode.Currency as the mode parameter to set stop losses and profit targets for both entries, using different values for each. For instance, for the entry named "LE1", I want to gain/lose $400, but for the entry named "LE2", I want to gain/lose $1,000.
I added the following lines of code were added to the proper places in the "OnStateChange()" section:
// In "if (State == State.SetDefaults)" section
StopTargetHandling = StopTargetHandling.PerEntryExecution; EntryHandling = EntryHandling.UniqueEntries;
SetStopLoss("LE1", CalculationMode.Currency, 400, false);
SetStopLoss("LE2", CalculationMode.Currency, 1000, false);
SetProfitTarget("LE1", CalculationMode.Currency, 400, false);
SetProfitTarget("LE2", CalculationMode.Currency, 1000, false);
When I try running the attached strategy, two problems occur:
Problem #1: The NT8 Log has a message that reads "Stop/target handling set to 'By strategy position' since currency based stop order was placed."
Problem #2: When both positions (one for each entry) are open at the same time, the stop loss or profit target that gets filled first in fact behaves in a way consistent with the message described in "Problem #1", in that instead of gaining/losing $400 for the position on which I set the stop loss and profit target to $400, it exits with a gain/loss of only $200, because presumably it sees that the two positions together are up/down $400. Note that the single remaining position does exit with the full $1,000 loss/gain.
Is this problem by design, or is it a bug that needs to be fixed?
You should be able to reproduce this issue by running the attached file on SPY.
Thank you very much,
EquityTrader
Comment