Hello. when I’m long and mine makes a stoploss, it continues to buy after it makes a stoploss when a new bar comes. I want it not to buy until it receives a new signal that it will go short. it’s the same when I’m short and want it not to buy again until I’m long stoploss 50 pips
Are you using below at the beginning of your code?
Defparam CumulateOrders = False
When set to false, prohibits a code from reinforcing positions and setting multiple orders to enter the market in the same direction.
thanks for quick reply . I’ll see if I have that code set to false, otherwise I’ll write again
This one will always enter alternate trades:
DEFPARAM CumulateOrders= false
ONCE Flag = 0 //1=last trade was LONG, -1=last trade was SHORT
Bull3 = summation[3](close > open) = 3
Bear3 = summation[3](close < open) = 3
LongConditions = close CROSSES OVER average[20,0](close) AND Bull3 AND Not LongOnMarket
ShortConditions = close CROSSES UNDER average[20,0](close) AND Bear3 AND Not ShortOnMarket
IF LongConditions AND Flag <> 1 THEN
BUY 1 CONTRACT AT MARKET
Flag = 1
SET TARGET pPROFIT 200
SET STOP pLOSS 100
ENDIF
IF ShortConditions AND Flag <> -1 THEN
SELLSHORT 1 CONTRACT AT MARKET
Flag = -1
SET TARGET pPROFIT 200
SET STOP pLOSS 100
ENDIF
thank you so much robertogozzi for great ideas as usual 😉