In my script I use also a multiple price-market entry; when, in backtest, I use only one strategy.entry the relative TP/SL of strategy.exit is always correctly applied ; when I use double entry with relative double exit it happens that: the first strategy.entry and exit is correct while in the second strategy.entry it happens that the relative TP and SL of its strategy.exit are wrong because take the values of the previous strategy.exit. All the entry and exit have different id ... I can't find my mistake. Can anyone help me? Thank's a lot. I can email you details. My email is [email protected]`
//condizioni ingresso ed uscita mercato secondo MACD UP/DOWN SU TF SETTIMANALE e MACD UP/DOWN SU TF GIORNALIERO
ConditionEntryL = MACDweekly>deltaweekly and crossover(MACDdaily, deltadaily) and MACDdaily < 0 and deltadaily < 0
ConditionEntryS = MACDweekly<deltaweekly and crossunder(MACDdaily, deltadaily) and MACDdaily > 0 and deltadaily > 0
//ingressi ed uscite Mercato - operazione LONG SU TF GG
strategy.entry ("MACDlong1",strategy.long, when = ConditionEntryL and TradeDateIsAllowed())
strategy.exit ("MACDlong1ex",profit = LongTP1, loss = LongSL1, when = ConditionEntryL and TradeDateIsAllowed())
strategy.entry ("MACDlong2",strategy.long, when = ConditionEntryL and TradeDateIsAllowed())
strategy.exit ("MACDlong2",profit = LongTP2, loss = LongSL2, when = ConditionEntryL and TradeDateIsAllowed())
//ingressi ed uscite Mercato - operazione SHORTSU TF GG
strategy.entry ("MACDshort1",strategy.short, when = ConditionEntryS and TradeDateIsAllowed())
strategy.exit ("MACDshort1ex", profit = ShortTP1, loss = ShortSL1, when = ConditionEntryS and TradeDateIsAllowed())
strategy.entry ("MACDshort2",strategy.short, when = ConditionEntryS and TradeDateIsAllowed())
strategy.exit ("MACDshort2ex", profit = ShortTP2, loss = ShortSL2, when = ConditionEntryS and TradeDateIsAllowed())
//condizioni ingresso ed uscita mercato secondo MACD UP/DOWN TF SETTIMANALE e MACD TF GIORNALIERO CHE INCROCIA LO ZERO
ConditionEntryL1 = MACDweekly>deltaweekly and MACDdaily>deltadaily and crossover(MACDdaily,0) and TradeDateIsAllowed()
ConditionEntryS1 = MACDweekly<deltaweekly and MACDdaily<deltadaily and crossunder(MACDdaily,0) and TradeDateIsAllowed()
//ingressi ed uscite Mercato - operazione LONG SU TF GG
strategy.entry ("MACDlongZ1",strategy.long, when = ConditionEntryL1 and TradeDateIsAllowed())
strategy.exit ("MACDlongZ1ex",profit = LongZTP1, loss = LongZSL1, when = ConditionEntryL1 and TradeDateIsAllowed())
strategy.entry ("MACDlongZ2",strategy.long, when = ConditionEntryL1 and TradeDateIsAllowed())
strategy.exit ("MACDlongZ2ex",profit = LongZTP2, loss = LongZSL2, when = ConditionEntryL1 and TradeDateIsAllowed())
//ingressi ed uscite Mercato - operazione SHORT SU TF GG
strategy.entry ("MACDshortZ1",strategy.short, when = ConditionEntryS1 and TradeDateIsAllowed())
strategy.exit ("MACDshortZ1ex", profit = ShortZTP1, loss = ShortZSL1, when = ConditionEntryS1 and TradeDateIsAllowed())
strategy.entry ("MACDshortZ2",strategy.short, when = ConditionEntryS1 and TradeDateIsAllowed())
strategy.exit ("MACDshortZ2ex", profit = ShortZTP2, loss = ShortZSL2, when = ConditionEntryS1 and TradeDateIsAllowed())