//-------------------------------------------------------------------------
// MONEY*M15*FEBBRAIO*2022
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = FALSE
PositionSize = 1
//**************************************************************
BollUp = BollingerUp[36](close)
BollDown = BollingerDown[38](close)
WB1 = (close[9]) > BollDown
WB2 = (close[28]) < BollUp
WB3 = (DClose(1) < DClose(0)[26])
tor1 = CALL "CONTEGGIO CANDELE"
WA1 = (tor1 < 2)
F = 20
S = 24
MFIFAST = MoneyFlowIndex[F]
MFISLOW = MoneyFlowIndex[S]
WA2 = MFISLOW[0] > MFISLOW[F] AND MFISLOW[0] > MFISLOW[ROUND(F/2)] AND MFISLOW[0] > MFISLOW[ROUND(F/8)]
WA3 = MFIFAST[0] > MFISLOW[0]
WA4 = RSI[14] (CLOSE) > 31
WA5 = STE[10] (CLOSE) > 5
tor2 = CALL "John Ehlers Adaptive CCI"
WA6 = (tor2 < 145)
//***************************************************************
//***************************************************************
LONG = WB1 AND WB2 AND WB3 AND WA1 AND WA2 AND WA3 AND WA4 AND WA5 AND WA6
IF LONG THEN
BUY PositionSize CONTRACT AT MARKET
SET STOP PLOSS 130
SET TARGET PPROFIT 130
ENDIF
//***************************************************************
//***************************************************************
//%trailing stop function
trailingPercent = .35 //.26
stepPercent = .25 //.014
if onmarket then
trailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailingstart points profit
trailingstep = tradeprice(1)*(stepPercent/100) //% step to move the stoploss
endif
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
newSL = tradeprice(1)+trailingstep
ENDIF
//next moves
IF newSL>0 AND close-newSL>trailingstep THEN
newSL = newSL+trailingstep
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
newSL = tradeprice(1)-trailingstep
ENDIF
//next moves
IF newSL>0 AND newSL-close>trailingstep THEN
newSL = newSL-trailingstep
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
Grazie Fabiano, potresti spiegarci come hai sviluppato la strategia? Dovresti anche condividere il codice ITF della strategia per consentire alle persone di ottenere gli indicatori necessari che stai utilizzando con CALL.
Buongiorno, allego i file .itf delle CALL utilizzate, la strategia è stata pensata per cercare… di prendere una partenza di un trend in long, ho testato tutti i parametri cercando di fare il meglio che mi riesce, con le mie poche conoscenze di programmazione.
Spero si possa implementare e sia utile…anche se vedo zero interesse per la strategia.
Grazie a TE Nicolas e a tutti quelli che aiutano in questo forum, Francesco, Grahal, Vonasi, Roberto Gozzi, Fifi, ecc….
Ciao Fabiano,
Grazie per aver condiviso la strategia, mi sembra ben fatta anche se esistono i rischi di solo due anni di statistica.
Potresti inserire un orario di trading iniziale e uno finale tipo questo.
timel = time >= 090000 and time <= 200000
Hai giustamente usato un trailing stop in percentuale, forse sarebbe meglio usare anche uno stop in percentuale per meglio adattarsi al valore del DOW J.
Per il target io userei un sistema che si adatta alla volatilità del momento tipo questo.
5* averagetruerange[10](close)
A volte uso anche un numero massimo di barre dove essere a mercato.
ONCE maxCandlesLongWithProfit = 185
ONCE maxCandlesLongWithoutProfit = 185
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
numberCandles = (BarIndex - TradeIndex)
m1 = posProfit > 0 AND numberCandles >= maxCandlesLongWithProfit
m3 = posProfit < 0 AND numberCandles >= maxCandlesLongWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
Fai delle prove e vedi come va……ma ricordati di metterlo prima in demo per un po di mesi per vedere se non è troppo ottimizato.
Ciao buona giornata.