Screener Help for Nicolas's Standard Deviation/Error LR Channel

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #119085 quote
    Newbie
    Participant
    Average

    Greetings team. I’ve been working on back testing with Nicolas’s Indicator here: https://www.prorealcode.com/prorealtime-indicators/standard-deviation-standard-error-linear-regression-channel/

    I’d like to develop a screener along with another indicator in order to share with you all, however, I’m a little stuck with the conditions. Ideally this is a question directly to Nicolas. But anyone who can help, please feel free. I can do the rest of the work on my own I think.

    As a visual indicator, this is amazing. But how does one detect digitally, when price (close) is above (>) the top line (+1) of the channel? I’m struggling with converting the drawn-line to a number or fixed point to use for a reference.

    Ideally I want to make the top line of the channel, indicator 1 and the bottom line, indicator 2 respectively.

    I think this has real potential…

    #119086 quote
    Vonasi
    Moderator
    Master

    I’m guessing that you want to know if the current bar is above or below the lines and not if a candle in the lookback period has been above or below  the lines?

    If so then a+b*0+dat is the upper line y value and a+b*0dat is the lower line y value for the current bar.

    Newbie thanked this post
    #119092 quote
    Newbie
    Participant
    Average

    absolutely that… Thanks, I’ll have a play round with that now and see the results. Thank you, Craig 🙂

    #119101 quote
    Nicolas
    Keymaster
    Master

    I’m sure that I made that screener already, let me check in the forums.

    #119103 quote
    Nicolas
    Keymaster
    Master

    I can’t find it now.. anyway, what you are looking for is if the price is exceding a linear regression + standard deviation factorized, should be coded like this:

    test = high > linearregression[lookback]+std[lookback]*NbDeviation OR low < linearregression[lookback]-std[lookback]*NbDeviation
    
    screener[test]

    (not tested)

    Newbie thanked this post
    #119208 quote
    Newbie
    Participant
    Average

    Okay guys… Thank you so far. I’ve managed to learn a bit more from what you’ve both told me and I’ve merged both comments into one screener prototype. However… the MAX units I can set for the lookback is 254, ideally I’d like this to be 300.

    I’m enclosing the code below for assistance. (Please keep in mind I’m a real newcomer, but I really am interested in learning more).

    // --- settings
    lookback= 254 //channel period
    ChannelType = 1 //1= Standard Deviation ; 2= Standard Erro
    NbDeviation = 1 //Deviation multiplier
    // --- end of settings
    
    sumx = 0
    sumy = 0
    sumxy = 0
    sumx2 = 0
    
    for cmpt = lookback downto 0 do
    tmpx = cmpt
    tmpy = close[cmpt]
    sumy = sumy+tmpy
    sumx = sumx+tmpx
    sumx2 = sumx2 + (tmpx*tmpx)
    sumxy = sumxy + (tmpy*tmpx)
    next
    
    n = lookback+1
    
    if (sumx2 = sumx * sumx) then // protection to avoid infinite values
    b = sumxy - sumx * sumy
    else
    b = (n * sumxy - sumx * sumy) / (n * sumx2 - sumx * sumx)
    endif
    a = (sumy - b * sumx) / n
    
    //channel
    if ChannelType = 1 then //Standard Deviation
    dat = std[lookback]*NbDeviation
    else
    dat = ste[lookback]*NbDeviation
    endif
    
    y = a+b*0+dat
    z = a+b*0-dat
    
    test = close > y OR close < z
     
    screener[test]
    

    Thanks for your help and patience, Craig 🙂

    #119231 quote
    Vonasi
    Moderator
    Master

    Yes 254 is the maximum lookback allowed in screeners unfortunately.

    Perhaps Nicolas’s simpler version returns the same results? Otherwise that is a screener based on that indicator.

    #119304 quote
    Nicolas
    Keymaster
    Master

    Indeed, because in realtime we don’t have to compute the affine function in order to plot a line in the past, the last point of the channel is enough.

    #121010 quote
    Newbie
    Participant
    Average

    Hi Nicolas

    I know you’re constantly bombarded with questions, however, I was wondering if there’s a way to code that both values must be “above” the top line. (Even though I know the line is only a drawn on object)! I’m working on this as developing the indicator for multi-timeframe, but then also for use later in a strategy to share. (I just want it to be better before sharing.

    So far I have…

    Timeframe (1 hour)
    
    test1 = high > linearregression[254]+std[254]*1 OR low < linearregression[254]-std[254]*1
    
    Timeframe (15 Minute)
    test2 = high > linearregression[254]+std[254]*1 OR low < linearregression[254]-std[254]*1
     
    screener[test1 AND test2]

    However, currently this would show when say the one hour is Above the Top line but the default or 15m is below the bottom line. I know that this is correct. But it’s not the outcome I wish to return.

    #121011 quote
    Newbie
    Participant
    Average

    I may have just answered my own question on this… If it’s not this, then any help would be received with gratitude.

    Timeframe (1 hour)
    
    test1 = high > linearregression[254]+std[254]*1 
    
    test2 = low < linearregression[254]-std[254]*1
    
    Timeframe (15 Minute)
    test3 = high > linearregression[254]+std[254]*1 
    test4 = low < linearregression[254]-std[254]*1
     
    screener [(test1 AND test2) OR (test3 AND test4)]
    #121033 quote
    Nicolas
    Keymaster
    Master

    You have indeed answered your own question 🙂 That last screener code seems correct to me!

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

Screener Help for Nicolas's Standard Deviation/Error LR Channel


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Newbie @newbie Participant
Summary

This topic contains 10 replies,
has 3 voices, and was last updated by Nicolas
6 years ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 02/09/2020
Status: Active
Attachments: No files
Logo Logo
Loading...