MACD IMPULSE ELDER DIVERGENCE

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12923 quote
    RECALL
    Participant
    Junior

    Bonjour,

    débutant en programmation je tente de déclencher un signal de vente si l’indicateur “MACD IMPULSE ELDER divergence-elder impulsebuy” regresse brutalement de plus -1 sans succes depuis plusieurs jours, auriez vous la gentillesse d’éclairer mes lanternes. je joint ici le code de l’indicateur de reference

    // variables
    // pc, fast ma, 12
    // pl, slow ma, 26
    // ps, signal, 9
    // p, exp ma EIS, 18
    // set first three as histograms
    pc=12
    pl=26
    ps=9
    p=13//periodos EIS
    aa=exponentialaverage[p](close)
    cc=MACD[pc,pl,ps](close)
    if aa > aa[1] and cc>cc[1] Then
    dd =cc*2
    else
    dd=0
    endif
    if aa<aa[1] and cc < cc[1] then
    ee=cc*2
    else
    ee=0
    endif
    if ( aa <aa[1] and cc > cc[1]) or (aa>aa[1] and cc<cc[1]) then
    ff=cc*2
    else
    ff=0
    endif
    REM MACD
    hh=exponentialaverage[pc](close) - exponentialaverage[pl](close)
    
    REM Signal
    hh1=exponentialaverage[ps](hh)
    
    // DIVERGENCES ZeroLag MACD adapted from HK-LISSE RSI divergences code
    
    EMAshort1 = exponentialaverage[pc](close)
    EMAshort2 = exponentialaverage[pc](EMAshort1)
    DifferenceShort = EMAshort1 - EMAshort2
    ZeroLagShort = EMAshort1 + DifferenceShort
    
    EMAlong1 = exponentialaverage[pl](close)
    EMAlong2 = exponentialaverage[pl](EMAlong1)
    DifferenceLong = EMAlong1 - EMAlong2
    ZeroLagLong = EMAlong1 + DifferenceLong
    
    ZeroLagMACD = ZeroLagShort - ZeroLagLong
    
    signal1=ExponentialAverage[ps](ZEROLAGMACD)
    signal2=ExponentialAverage[ps](signal1)
    DIFFERENCE2=signal1-signal2
    
    SignalMACD=signal1+DIFFERENCE2
    x = ZeroLagMACD
    y = SignalMACD
    
    // BEARISH DIVERGENCES MACD
    hi=max(hi,x)
    hico=max(hico,max(high,high[1]))
    
    if x crosses under y then
    sto2b=sto1b
    sto1b=hi
    hi=0
    p3b=p1b
    p2b=max(p1b,hico1)
    p1b=max(highest[3](high),hico)
    if p2b=p1b then
    p2b=max(p3b,p4b)
    endif
    hico=0
    hico1=0
    endif
    if x<y then
    p4b=hico1
    hico1=max(hico1,high)
    endif
    if p1b>p2b and sto1b<sto2b and x crosses under y and x<x[1] then
    signB= hh//-2
    else
    signB= 0
    endif
    
    // BULLISH MACD DIVERGENCES
    lo=min(lo,x)
    lowco=min(lowco,min(low,low[1]))
    
    if x CROSSES OVER y then
    sto2h=sto1h
    sto1h=lo
    lo=100
    p3h=p1h
    p2h=min(p1h,lowco1)
    p1h=min(lowest[3](low),lowco)
    if p2h=p1h then
    p2h=min(p3h,p4h)
    endif
    lowco=100000
    lowco1=100000
    endif
    if x>y then
    p4h=lowco1
    lowco1=min(lowco1,low)
    endif
    if p1h<p2h and sto1h > sto2h and x crosses over y and x>x[1] then
    signH= hh//2
    else
    signH= 0
    endif
    return dd*pipsize COLOURED(0,255,0) as "elder impulsebuy", ee*pipsize COLOURED(255,0,0) as "elder impulsesell", ff*pipsize coloured(0,0,255) as "elder impulsechange", hh*pipsize as "macd", hh1*pipsize as "signal macd", signH*pipsize as "Bullish MACD Divergence", signB*pipsize as "Bearish MACD Divergence" , 0 as " zero "
    MACD-IMPULSE-ELDER-divergence.itf
    #12926 quote
    RECALL
    Participant
    Junior

    Voici mon début

    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    // Conditions pour ouvrir une position en vente à découvert
    indicator1, ignored, ignored, ignored, ignored, ignored, ignored, ignored = CALL "MACD IMPULSE ELDER divergence"
    c1 = (indicator1 >= 3.8)
    
    indicator2, ignored, ignored, ignored, ignored, ignored, ignored, ignored = CALL "MACD IMPULSE ELDER divergence"
    indicator3, ignored, ignored, ignored, ignored, ignored, ignored, ignored = CALL "MACD IMPULSE ELDER divergence"
    c2 = (indicator2 CROSSES UNDER indicator3)
    
    IF c1 AND c2 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Stops et objectifs
    SET STOP pLOSS 12
    SET TARGET pPROFIT 2
    #12927 quote
    RECALL
    Participant
    Junior

    voilà çà marche en revanche je n’arrive pas à sélectionner que les signaux très violents

    // Définition des paramètres du code
    DEFPARAM CUMULATEORDERS = FALSE
    DEFPARAM FLATBEFORE = 080000
    DEFPARAM FLATAFTER = 220000
    
    // Conditions pour ouvrir une position en vente à découvert
    indicator1, ignored, ignored, ignored, ignored, ignored, ignored, ignored = CALL "MACD IMPULSE ELDER divergence"
    c1 = (indicator1 >= 7)
    
    indicator2, ignored, ignored, ignored, ignored, ignored, ignored, ignored = CALL "MACD IMPULSE ELDER divergence"
    
    c2 = ((indicator2-2) < indicator1)
    
    IF c1 AND c2 THEN
    SELLSHORT 4 CONTRACT AT MARKET
    ENDIF
    
    // Stops et objectifs
    SET STOP pLOSS 10
    SET TARGET pPROFIT 4
    #12947 quote
    Nicolas
    Keymaster
    Master

    Merci d’utiliser le bouton d’insertion de code pour une meilleure compréhension les prochaines fois 🙂

    Quels sont les signaux très violents que tu souhaiterai uniquement prendre? Une ou deux images permettrai de bien comprendre la demande, merci.

    #13247 quote
    RECALL
    Participant
    Junior

    Merci Nicolas je n’avais pas vu ton post, je progresse…..

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

MACD IMPULSE ELDER DIVERGENCE


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
RECALL @recall Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by RECALL
9 years, 4 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 09/10/2016
Status: Active
Attachments: No files
Logo Logo
Loading...