Roberto buongiorno,
dopo aver bazzicato per 2 anni in PRT , ho provato a trasformare in codice una mia idea e cioè ; se ci sono due candele ascendenti si va long se il segnale è confermato da un indicatore, ho messo poi un filtro con volume e stop loss / profit /thrilling (in allegato).
La mia domanda è se il su codice ha una sua logicità, lo sto provando su EUR/USD TF 1 Spread 0,2 ora e mi da dei discreti risultati.
DEFPARAM CumulateOrders = False // Posizioni cumulate disattiva
TradingTime=Time>=090000and Time<=210000
td = opendayofweek >= 1 and opendayofweek <= 5
//condizioni per entrata long
indicator1 = Volume
indicator2 = ExponentialAverage[14](Volume)
c3 = (indicator1 >= indicator2)
ONCE c1 = 0
ONCE c2 = 0
IF c1 = 0 AND Not OnMarket THEN
c1 = ( close > open and close[1] > open[1] )
ENDIF
indicator3 = CALL “PRC_Adjustible CoRa_Wave”[20, 2, 1, 1](close)
IF c2 = 0 AND Not OnMarket THEN
c2 = (close >= indicator3)
ENDIF
IF c1 AND c2 AND td and c3 and TradingTime THEN
BUY 1 CONTRACT AT MARKET
c1 = 0
c2 = 0
ENDIF
SET STOP LOSS l*AverageTrueRange[10](close)
SET TARGET PROFIT p*AverageTrueRange[12](close)
//SET STOP PLOSS l
//SET TARGET PPROFIT p
//************************************************************************
//trailing stop
trailingstop = tra
//resetting variables when no trades are on market
if not onmarket then
MAXPRICE = 0
MINPRICE = close
priceexit = 0
endif
//case SHORT order
if shortonmarket then
MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
endif
endif
//case LONG order
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE – trailing stop price level
endif
endif
Grazie