LUX ALGO -Breakout screener

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #211775 quote
    kumar_AK
    Participant
    Junior

    Reference Link

    i recently started using the luxalgo indicator on trading view.

    i wanted to use this logic for pre-real code screener for identifying break outs.

    need some help to convert this logic in to pre-real screener logic.

    // inpout values
    length = 14
    k = 1.0
    method = 0 //'Slope Calculation Method' 0='Atr' 1='Stdev' 2='Linreg'
    //show = input(false,'Show Only Confirmed Breakouts')
    
    //--initialise variables
    upper = 0
    lower = 0
    slopeph = 0
    
    src = close
    n = max(1,barindex)
    //----
    once cp = length
    
    if high[cp] >= highest[2*cp+1](high) then
    LH = 1
    else
    LH=0
    endif
    if low[cp] <= lowest[2*cp+1](low)  then
    LL= -1
    else
    LL=0
    endif
    if LH=1 then
    ph = high[cp]
    endif
    if LL  = -1 then
    pl=low[cp]
    endif
    //slope
    if method = 0 then
    slope = AverageTrueRange[length](close)/length*k
    elsif method = 1 then
    slope = STD[length](close)/length*k
    else
    //'Linreg' => math.abs(ta.sma(src*bar_index,length)-ta.sma(src,length)*ta.sma(bar_index,length))/ta.variance(n,length)/2*k
    ivalue=n
    mperiod=length
    m=0
    s=0
    oldm=0
    for k=0 to mperiod-1 do
    oldm = m
    m    = m+(ivalue[k]-m)/(1.0+k)
    s    = s+(ivalue[k]-m)*(ivalue[k]-oldm)
    next
    variance = (s/(mperiod-1))
    slope = abs(average[length](src*barindex)-average[length](src)*average[length](barindex))/variance/2*k
    endif
    
    //slope_ph := ph ? slope : slope_ph[1]
    //upper := ph ? ph : upper[1] - slope_ph
    if ph<>ph[1]then
    slopeph=slope
    upper=ph
    else
    slopeph=slopeph[1]
    upper=upper[1] - slopeph
    endif
    
    singleupper = 0
    singlelower = 0
    //single_upper := src[length] > upper ? 0 : ph ? 1 : single_upper[1]
    if src[length]>upper then
    singleupper=0
    else
    if ph<>ph[1] then
    singleupper=1
    else
    singleupper=singleupper[1]
    endif
    endif
    //single_lower := src[length] < lower ? 0 : pl ? 1 : single_lower[1]
    if src[length]<lower then
    singlelower=0
    else
    if pl<>pl[1] then
    singlelower=1
    else
    singlelower=singlelower[1]
    endif
    endif
    
    //upper_breakout = single_upper[1] and src[length] > upper and (show ? src > src[length] : 1)
    upperbreakout = singleupper[1] and src[length] > upper and src > src[length]
    
    
    SCREENER(upperbreakout as "close")
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

LUX ALGO -Breakout screener


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
kumar_AK @kumar_ak Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 03/20/2023
Status: Active
Attachments: No files
Logo Logo
Loading...