ASCTrend + MACD

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #163368 quote
    larouedegann
    Participant
    Master

    Bonjour,

    j’aimerai coupler l’indicateur ASCTrend avec la ligne MACD

    mcd = MACDline[12,26,9](close)
    c1 = mcd<0
    c2 = mcd>0

    de manière à ce que le DRAWARROWDOWN (de ASCTrend) prenne en compte c2 et DRAWARROWUP la c1.

    //PRC_ASCTrend | indicator
    //13.01.2021
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //converted from MT4 version
     
    // --- settings 
    RISK=3
    CountBars=300
    // --- end of settings 
     
    value10=3+RISK*2
    x1=67+RISK
    x2=33-RISK
    value11=value10
     
    shift=CountBars-11-1
     
    if islastbarupdate and barindex>CountBars then 
    while(shift>=0) do 
     
    Counter=shift
    iRange=0.0
    AvgRange=0.0
    for Counter=shift to shift+9 do 
    AvgRange=AvgRange+Abs(High[Counter]-Low[Counter])
    next
     
    iRange=AvgRange/10
    Counter=shift
    TrueCount=0
    while (Counter<shift+9 and TrueCount<1) do 
    if (Abs(Open[Counter]-Close[Counter+1])>=iRange*2.0) then 
    TrueCount=TrueCount+1
    endif
    Counter=Counter+1
    wend
    if (TrueCount>=1) then 
    MRO1=Counter
    else 
    MRO1=-1
    endif 
     
    Counter=shift
    TrueCount=0
    while (Counter<shift+6 and TrueCount<1) do 
    if (Abs(Close[Counter+3]-Close[Counter])>=iRange*4.6) then 
    TrueCount=TrueCount+1
    endif
    Counter=Counter+1
    wend
    if (TrueCount>=1) then 
    MRO2=Counter
    else
    MRO2=-1
    endif
     
     
    if (MRO1>-1) then 
    value11=3
    else 
    value11=value10
    endif
    if (MRO2>-1) then 
    value11=4
    else 
    value11=value10
    endif 
     
    value2=100-Abs(Williams[value11](close)[shift]) // PercentR(value11=9)
    $Tablevalue2[shift]=value2
    $val1[shift]=0
    $val2[shift]=0
    value3=0
     
    if (value2<x2) then 
    i1=1
    while ($Tablevalue2[shift+i1]>=x2 and $Tablevalue2[shift+i1]<=x1) do 
    i1=i1+1
    wend
    if ($Tablevalue2[shift+i1]>x1) then 
    value3=High[shift]+iRange*0.5
    if (shift = 1 and flagval1=0) then
    flagval1=1
    flagval2=0
    endif
    $val1[shift]=value3
    drawarrowdown(barindex[shift],$val1[shift]) coloured(255,0,255)
    endif
    endif
     
    if (value2>x1) then 
    i1=1
    while ($Tablevalue2[shift+i1]>=x2 and $Tablevalue2[shift+i1]<=x1) do 
    i1=i1+1
    wend
    if ($Tablevalue2[shift+i1]<x2) then 
    value3=Low[shift]-iRange*0.5
    if (shift = 1 and flagval2=0) then 
    flagval2=1
    flagval1=0
    endif
    $val2[shift]=value3
    drawarrowup(barindex[shift],$val2[shift]) coloured(0,255,255)
    endif
    endif
     
     
    shift=shift-1
    wend
    endif 
    return

    j’ai tout essayé dans les conditions de asctrend, mais je ne suis pas arrivé.

    Si quelqu’un à une solution ? c’est avec plaisir.

    BUNDXXXX_8-1-minute.png BUNDXXXX_8-1-minute.png
    #163411 quote
    Nicolas
    Keymaster
    Master

    La version que tu utilises place les flèches dans le passé à partir de la bougie courante, la version ci-dessous le fait en lisant l’historique (code plus simple à comprendre si tu ne maîtrises pas les array), j’ai intégré ta condition sur le MACD.

    // --- settings
    RISK=3
    // --- end of settings
    
    mcd = MACDline[12,26,9](close)
    c1 = mcd<0
    c2 = mcd>0
    
    value10=3+RISK*2
    x1=67+RISK
    x2=33-RISK
    value11=value10
    
    shift=0//CountBars-11-1
    buysig=0
    sellsig = 0
    
    Counter=shift
    iRange=0.0
    AvgRange=0.0
    for Counter=shift to shift+9 do
    AvgRange=AvgRange+Abs(High[Counter]-Low[Counter])
    next
    
    iRange=AvgRange/10
    Counter=shift
    TrueCount=0
    while (Counter<shift+9 and TrueCount<1) do
    if (Abs(Open[Counter]-Close[Counter+1])>=iRange*2.0) then
    TrueCount=TrueCount+1
    endif
    Counter=Counter+1
    wend
    if (TrueCount>=1) then
    MRO1=Counter
    else
    MRO1=-1
    endif
    
    Counter=shift
    TrueCount=0
    while (Counter<shift+6 and TrueCount<1) do
    if (Abs(Close[Counter+3]-Close[Counter])>=iRange*4.6) then
    TrueCount=TrueCount+1
    endif
    Counter=Counter+1
    wend
    if (TrueCount>=1) then
    MRO2=Counter
    else
    MRO2=-1
    endif
    
    
    if (MRO1>-1) then
    value11=3
    else
    value11=value10
    endif
    if (MRO2>-1) then
    value11=4
    else
    value11=value10
    endif
    
    value2=100-Abs(Williams[value11](close)[shift]) // PercentR(value11=9)
    
    if (value2<x2) then
    //signals
    if value2[1]>x2[1] and lastsig>=0 and c2 then
    sellsig = 1
    lastsig = -1
    drawarrowdown(barindex[0],High[0]+iRange*0.5) coloured(255,0,255)
    endif
    endif
    
    if (value2>x1) then
    //signals
    if value2[1]<x1[1] and lastsig<=0 and c1 then
    buysig = 1
    lastsig = 1
    drawarrowup(barindex[0],Low[0]-iRange*0.5) coloured(0,255,255)
    endif
    endif
    
    return
    #163425 quote
    larouedegann
    Participant
    Master

    merci nicolas

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

ASCTrend + MACD


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by larouedegann
5 years ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 03/07/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...