Bonjour à tous,
ci-joint un algo basé sur l’indicateur QMP FILTER et le graphique Heikin ashi.
Je débutes en codage donc si vous avez des suggestions d’amélioration 🙂
Bonne journée à tous
defparam cumulateorders=false
defparam flatbefore=080000
defparam flatafter=170000
//—QMP Filter PARAMETRES
short = A10 //12
long = A11 //26
signal = A12 //9
RSIPeriod = A13 //8
SF = A14 //1
QQE = A15 //3
//—
// — MACD ZeroLag
EMAshort1 = exponentialaverage[short](close)
EMAshort2 = exponentialaverage[short](EMAshort1)
DifferenceShort = EMAshort1 – EMAshort2
ZeroLagShort = EMAshort1 + DifferenceShort
EMAlong1 = exponentialaverage[long](close)
EMAlong2 = exponentialaverage[long](EMAlong1)
DifferenceLong = EMAlong1 – EMAlong2
ZeroLagLong = EMAlong1 + DifferenceLong
ZeroLagMACD = ZeroLagShort – ZeroLagLong
signal1=ExponentialAverage[signal](ZEROLAGMACD)
signal2=ExponentialAverage[signal](signal1)
DIFFERENCE2=signal1-signal2
SignalMACD=signal1+DIFFERENCE2
// — QQE
WildersPeriod = RSIPeriod * 2 – 1
if barindex>WildersPeriod then
MyRsi = rsi[RSIPeriod](close)
RsiMa = exponentialaverage[SF](MyRsi)
AtrRsi = abs(RsiMa[1] – RsiMa)
MaAtrRsi = exponentialaverage[WildersPeriod](AtrRsi)
dar = exponentialaverage[WildersPeriod](MaAtrRsi) * QQE
trr=TrLevelSlow[1]
dv = trr
if RsiMA[0]<trr then
trr = RsiMA[0] + dar
if(RsiMA[1]<dv) then
if(trr>dv) then
trr=dv
endif
endif
elsif RsiMA[0]>trr then
trr = RsiMA[0] – dar
if(RsiMA[1]>dv) then
if(trr<dv) then
trr=dv
endif
endif
endif
TrLevelSlow=trr
endif
// — signals
if zerolagMACD>=signalMACD and RsiMA>=trr and lasttrend<>1 then
lasttrend=1
elsif zerolagMACD<signalMACD and RsiMA<trr and lasttrend<>-1 then
lasttrend=-1
endif
gobuy = lasttrend=1 and lasttrend[1]=-1
gosell = lasttrend=-1 and lasttrend[1]=1
//HEIKIN ASHI PARAMETRES
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
c1 = xClose>xOpen AND xClose[1]<xOpen[1]
c2 = xClose<xOpen AND xClose[1]>xOpen[1]
if c1 and Not LongOnMarket and close > gobuy then
BUY 2 SHARE AT MARKET
endif
set stop ptrailing sl
if c2 and Not ShortOnMarket and close < gosell then
SELLSHORT 2 SHARE AT MARKET
endif
set stop ptrailing sl
2 users thanked author for this post.