My LR Chanel on MACD Histogram doesn't work

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #75891 quote
    thomas2004ch
    Participant
    Average

    Hi,

    I try to apply the LR-Chanel indicator created by Nikolas on the MACD Histogram but it shows nothing when I add this onto the MACD.

    My code looks as follow:

    REM Dieses Beispiel berechnet den MACD Indikator.
    
    //Parameters :
    // Len = 100
    // percent = 0.002
    
    fastMA = exponentialAverage[p](close)
    slowMA = exponentialAverage[q](close)
    
    myMACD = fastMA - slowMA
    line1 = exponentialAverage[r](myMACD)
    
    hist = myMACD - line1
    
    once j=0
    de48=DPO[Len*2](hist)
    if de48=de48[1] and de48[1]=de48[2] and de48[2]<>de48[3] then
    flag=1
    endif
     
    n=(Len*2)-4
    p=(n/2)-1
    d100=DPO[n](hist)
    moy100=hist-d100
    co=(moy100-moy100[1]+(hist[p])/n)*n
    if flag=1 and flag[1]=0 then
    test=linearregression[Len](co)
    test1=linearregressionslope[Len](co)
    a=test1
    b=test-test1*Len
    endif
     
    if flag=0 then
    reg=undefined
    else
    j=j+1
    reg=a*j+b
    endif
     
    RETURN reg COLOURED(255,0,0) as "channel center"
     
    
    #75901 quote
    Nicolas
    Keymaster
    Master

    Where is from the original code of the LR channel please?

    In your code, flag will never be equal to 1 and thus calculation of the channel will never start. Condition at line 17 will surely never be true, that’s where the trouble is, at the first glance.

    #75935 quote
    thomas2004ch
    Participant
    Average

    Hi Nicolas,

    I forgot where I exactly see this code. It is definitely from this forum. I though it was from you.

    >>…Condition at line 17 will surely never be true…

    Why? If I replace the ‘hist’ with ‘close’ or ‘high’ or ‘low’. It works (without the MACD code).

    #75937 quote
    thomas2004ch
    Participant
    Average

    Now I find out where I see the LR Channel code. It is here:

    Linear Regression Channel with percent upper and lower lines

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

My LR Chanel on MACD Histogram doesn't work


ProBuilder Support

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by thomas2004ch
7 years, 6 months ago.

Topic Details
Forum: ProBuilder Support
Language: German
Started: 07/13/2018
Status: Active
Attachments: No files
Logo Logo
Loading...