I’ve “translated” the formula from Tradingview (Pine Editor) to Prorealtime (similar to Easylanguage).
Results are no so encouraging like the “previous” system and, one more time, the strategy select well then buy & hold wins in term of performance (from 2017, +300% while T.s. gives only a gross 80%)
DEFPARAM cumulateorders = false
// buffer is a variable to be optimized . Dominio is between 0 and 3, step 0.1
b1 = close[1]*(1+buffer/100)
b2 = close[1]*(1-buffer/100)
// q is a variable: you have to invest q*1000 $ or €
q1 = q *1000
// Condizioni per entrare su posizioni long
IF NOT LongOnMarket AND close > b1 THEN
BUY 10000 cash AT MARKET
ENDIF
// Condizioni per uscire da posizioni long
If LongOnMarket AND close < b2 THEN
SELL AT MARKET
ENDIF
// Stop e target: Inserisci qui i tuoi stop di protezione e profit target
// pr and lo are parameters that have to been optimized
// profit = 50% by default, loss = 15%
set target %profit pr
set stop %loss lo