Trend Impulse with Range Filter V2

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #149120 quote
    Ichimoku Reading
    Participant
    Master

    Hello,

    Today, I publish the V2 of the previous indicator.

    This one is very similar to the first one however, it includes more precise calculations.
    I chose to take the same sequence of the graph so that you can compare the two images.

    The notable effects are the detection of the ranges, they are done much earlier.
    The entry points or pulse points remain the same, which means that the indicator is not seen with a secondary filter, but rather an adjustment in terms of precision.

    The external variable remains the same and the use of the same

    IV

    //
    //=/===============/=//=/===============/=//=/ Indicator Range Trend
    //
    
    RxUP = 0
    GxUP = 153
    BxUP = 255
    
    RxDOWN = 102
    GxDOWN = 102
    BxDOWN = 102
    
    //
    //=/===============/=//=/===============/=//=/ Range
    //
    
    //=/ Range Settings
    once rngfilt=close
    
    if barindex>max(14,27) then
    rngscale=max(1,min(rngscale,7))
    
    scale = 2.618*average[14,1](abs(close-close[1]))
    
    endif
    
    r=average[27,1](scale)
    
    hh=close
    ll=close
    if 1<>1 then
    hh=high
    ll=low
    endif
    if 1=1 then
    if hh>rngfilt[1] then
    if (hh-r)<rngfilt[1] then
    rngfilt=rngfilt[1]
    else
    rngfilt=hh-r
    endif
    elsif (ll+r)>rngfilt[1] then
    rngfilt=rngfilt[1]
    else
    rngfilt=ll+r
    endif
    else
    if hh>=rngfilt[1]+r then
    rngfilt=(rngfilt[1]) + (abs(hh - (rngfilt[1]))/r)*r
    elsif ll<=rngfilt[1]-r then
    rngfilt=(rngfilt[1]) - (abs(ll - (rngfilt[1]))/r)*r
    else
    rngfilt=rngfilt[1]
    endif
    endif
    
    hiband    = rngfilt + r
    loband    = rngfilt - r
    
    if rngfilt>rngfilt[1] then
    upward=1
    downward=0
    endif
    if rngfilt<rngfilt[1] then
    upward=0
    downward=1
    endif
    
    TrendFast = rngfilt
    TrendMedium = Average[2](rngfilt)
    TrendLong = Average[4](rngfilt)
    Limitt = (close+TrendFast)/2
    
    //
    //=/===============/=//=/===============/=//=/ Trend Color
    //
    
    //=/ Trend Fast Color Settings
    if upward > 0 and TrendFast > TrendFast[1] then
    cr = RxUP
    cg = GxUP
    cb = BxUP
    ct = 250
    
    elsif downward > 0 and TrendFast < TrendFast[1] then
    cr = RxDOWN
    cg = GxDOWN
    cb = BxDOWN
    ct = 250
    
    elsif upward > 0 and TrendFast = TrendFast[1] then
    cr = RxUP
    cg = GxUP
    cb = BxUP
    ct = 100
    
    elsif downward > 0 and TrendFast = TrendFast[1] then
    cr = RxDOWN
    cg = GxDOWN
    cb = BxDOWN
    ct = 100
    
    endif
    
    //
    //=/===============/=//=/===============/=//=/ Candle
    //
    
    //=/ Bullish Conditions 1P
    UP1 = upward > 0
    UP2 = close > TrendFast
    UP3 = close > TrendLong
    UP4 = close > TrendMedium
    UP5 = TrendFast > TrendFast[1]
    UP6 = TrendLong > TrendLong[1]
    UP7 = TrendMedium > TrendMedium[1]
    UP8 = low =< Limitt
    UP9 = close > MID4
    BullishConditions1P = UP1 and UP2 and UP3 and UP4 and UP5 and UP6 and UP7 and UP8 and UP9
    
    //=/ Bullish Conditions 1PS
    UPS1 = upward > 0
    UPS2 = close > TrendFast
    UPS3 = close > TrendLong
    UPS4 = close > TrendMedium
    UPS5 = TrendFast > TrendFast[1]
    UPS6 = TrendLong > TrendLong[1]
    UPS7 = TrendMedium > TrendMedium[1]
    UPS8 = low > Limitt
    UPS9 = Limitt => MID4
    UPS10 = close > MID4
    BullishConditions1PS = UPS1 and UPS2 and UPS3 and UPS4 and UPS5 and UPS6 and UPS7 and UPS8 and UPS9 and UPS10
    
    //=/ Bullish Conditions 1
    U1 = upward > 0
    U2 = close > TrendFast
    U3 = close > TrendLong
    U4 = close > TrendMedium
    U5 = TrendFast > TrendFast[1]
    U6 = TrendLong > TrendLong[1]
    U7 = TrendMedium > TrendMedium[1]
    U8 = low > Limitt
    U9 = close > MID4
    BullishConditions1 = U1 and U2 and U3 and U4 and U5 and U6 and U7 and U8 and U9
    
    //=/ Bullish Conditions 2
    UX1 = upward > 0
    UX2 = close > TrendFast
    UX3 = close > TrendLong
    UX4 = close > TrendMedium
    UX5 = TrendFast = TrendFast[1]
    UX6 = TrendLong > TrendLong[1]
    UX7 = TrendMedium > TrendMedium[1]
    UX8 = low > Limitt
    UX9 = close > MID4
    BullishConditions2 = UX1 and UX2 and UX3 and UX4 and UX5 and UX6 and UX7 and UX8 and UX9
    
    //=/ Bullish Conditions 3
    UXX1 = upward > 0
    UXX2 = close > TrendFast
    UXX3 = close > TrendLong
    UXX4 = close > TrendMedium
    UXX5 = TrendFast = TrendFast[1]
    UXX6 = TrendLong > TrendLong[1]
    UXX7 = TrendMedium = TrendMedium[1]
    UXX8 = low > Limitt
    UXX9 = close > MID4
    BullishConditions3 = UXX1 and UXX2 and UXX3 and UXX4 and UXX5 and UXX6 and UXX7 and UXX8 and UXX9
    
    //=//=//
    
    //=/ Bearish Conditions 1P
    EP1 = downward > 0
    EP2 = close < TrendFast
    EP3 = close < TrendLong
    EP4 = close < TrendMedium
    EP5 = TrendFast < TrendFast[1]
    EP6 = TrendLong < TrendLong[1]
    EP7 = TrendMedium < TrendMedium[1]
    EP8 = high => Limitt
    EP9 = close < MID11
    BearishConditions1P = EP1 and EP2 and EP3 and EP4 and EP5 and EP6 and EP7 and EP8 and EP9
    
    //=/ Bearish Conditions 1PS
    EPS1 = downward > 0
    EPS2 = close < TrendFast
    EPS3 = close < TrendLong
    EPS4 = close < TrendMedium
    EPS5 = TrendFast < TrendFast[1]
    EPS6 = TrendLong < TrendLong[1]
    EPS7 = TrendMedium < TrendMedium[1]
    EPS8 = high < Limitt
    EPS9 = Limitt =< MID11
    EPS10 = close < MID11
    BearishConditions1PS = EPS1 and EPS2 and EPS3 and EPS4 and EPS5 and EPS6 and EPS7 and EPS8 and EPS9 and EPS10
    
    //=/ Bearish Conditions 1
    E1 = downward > 0
    E2 = close < TrendFast
    E3 = close < TrendLong
    E4 = close < TrendMedium
    E5 = TrendFast < TrendFast[1]
    E6 = TrendLong < TrendLong[1]
    E7 = TrendMedium < TrendMedium[1]
    E8 = high < Limitt
    E9 = close < MID11
    BearishConditions1 = E1 and E2 and E3 and E4 and E5 and E6 and E7 and E8 and E9
    
    //=/ Bearish Conditions 2
    EX1 = downward > 0
    EX2 = close < TrendFast
    EX3 = close < TrendLong
    EX4 = close < TrendMedium
    EX5 = TrendFast = TrendFast[1]
    EX6 = TrendLong < TrendLong[1]
    EX7 = TrendMedium < TrendMedium[1]
    EX8 = high < Limitt
    EX9 = close < MID11
    BearishConditions2 = EX1 and EX2 and EX3 and EX4 and EX5 and EX6 and EX7 and EX8 and EX9
    
    //=/ Bearish Conditions 3
    EXX1 = downward > 0
    EXX2 = close < TrendFast
    EXX3 = close < TrendLong
    EXX4 = close < TrendMedium
    EXX5 = TrendFast = TrendFast[1]
    EXX6 = TrendLong < TrendLong[1]
    EXX7 = TrendMedium = TrendMedium[1]
    EXX8 = high < Limitt
    EXX9 = close < MID11
    BearishConditions3 = EXX1 and EXX2 and EXX3 and EXX4 and EXX5 and EXX6 and EXX7 and EXX8 and EXX9
    
    //=/ Candle Color Settings
    if BullishConditions1P then
    br = RxUP
    bg = GxUP
    bb = BxUP
    tz = 250
    
    elsif BullishConditions1PS then
    br = RxUP
    bg = GxUP
    bb = BxUP
    tz = 250
    
    elsif BullishConditions1 then
    br = RxUP
    bg = GxUP
    bb = BxUP
    tz = 185
    
    elsif BullishConditions2 then
    br = RxUP
    bg = GxUP
    bb = BxUP
    tz = 125
    
    elsif BullishConditions3 then
    br = RxUP
    bg = GxUP
    bb = BxUP
    tz = 100
    
    //=//=//
    elsif BearishConditions1P then
    br = RxDOWN
    bg = GxDOWN
    bb = BxDOWN
    tz = 250
    
    elsif BearishConditions1PS then
    br = RxDOWN
    bg = GxDOWN
    bb = BxDOWN
    tz = 250
    
    elsif BearishConditions1 then
    br = RxDOWN
    bg = GxDOWN
    bb = BxDOWN
    tz = 185
    
    elsif BearishConditions2 then
    br = RxDOWN
    bg = GxDOWN
    bb = BxDOWN
    tz = 125
    
    elsif BearishConditions3 then
    br = RxDOWN
    bg = GxDOWN
    bb = BxDOWN
    tz = 100
    
    //=//=//
    
    else
    br = 204
    bg = 204
    bb = 204
    tz = 180
    endif
    
    drawcandle(open,high,low,close) coloured(br,bg,bb,tz)
    
    //
    //=/===============/=//=/===============/=//=/ Visual
    //
    
    //=/ Visual Settings
    MIDX1 = (hiband-TrendFast)/8
    MID1 = (TrendFast+MIDX1)
    MID2 = (MID1+MIDX1)
    MID3 = (MID2+MIDX1)
    MID4 = (MID3+MIDX1)
    MID5 = (MID4+MIDX1)
    MID6 = (MID5+MIDX1)
    MID7 = (MID6+MIDX1)
    
    MIDX2 = (TrendFast-loband)/8
    MID8 = (TrendFast-MIDX2)
    MID9 = (MID8-MIDX2)
    MID10 = (MID9-MIDX2)
    MID11 = (MID10-MIDX2)
    MID12 = (MID11-MIDX2)
    MID13 = (MID12-MIDX2)
    MID14 = (MID13-MIDX2)
    
    //
    //=/===============/=//=/===============/=//=/ End
    //
    
    return TrendFast coloured (cr,cg,cb,ct) style(line,2) as "Trend Fast"     ,     MID1 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID1"     ,     MID2 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID2"     ,     MID3 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID3"    ,    MID4 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID4"     ,     MID5 coloured (RxUP,GxUP,BxUP,15) style(line,1) as "MID5"      ,     MID6 coloured (RxUP,GxUP,BxUP,15) style(line,1) as "MID6"     ,     MID7 coloured (RxUP,GxUP,BxUP,15) style(line,1) as "MID7"     ,     MID8 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID8"     ,     MID9 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID9"     ,     MID10 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID10"     ,     MID11 coloured (RxDOWN,GxDOWN,BxDOWN,15) style(line,1) as "MID11"     ,     MID12 coloured (RxUP,GxUP,BxUP,15) style(line,1) as "MID12"     ,     MID13 coloured (RxUP,GxUP,BxUP,15) style(line,1) as "MID13"     ,     MID14 coloured (RxUP,GxUP,BxUP,15) style(line,1) as "MID14"     ,     hiband coloured (RxUP,GxUP,BxUP,15) style(line,1) as "Hiband"     ,     loband coloured (RxUP,GxUP,BxUP,15) style(line,1) as "Loband"     ,     Limitt coloured (cr,cg,cb,ct) style(line,1) as "Limit"

     

    Nolubok thanked this post
    capture-1604216582l48pc.png capture-1604216582l48pc.png Trend-Impulse.itf capture-1604216582l48pc1.png capture-1604216582l48pc1.png Trend-Impulse-1.itf
    #149271 quote
    Nicolas
    Keymaster
    Master

    Thanks for sharing. I added the link to this forum thread in your first version of the indicator in the library: Trend Impulse with Range Filter

    Ichimoku Reading thanked this post
    #149323 quote
    Ichimoku Reading
    Participant
    Master

    La V3

    //
    //=/===============/=//=/===============/=//=/ Indicator Range Trend
    //
    
    RxUP = 0
    GxUP = 153
    BxUP = 255
    
    RxDOWN = 102
    GxDOWN = 102
    BxDOWN = 102
    
    RxRange = 204
    GxRange = 204
    BxRange = 204
    
    RxForce = 199
    GxForce = 19
    BxForce = 19
    
    RangeScale = 2.338
    
    //
    //=/===============/=//=/===============/=//=/ Range
    //
    
    //=/ Range Settings
    once RRange=close
    
    if barindex>max(14,27) then
    RNGScale=max(1,min(RNGScale,7))
    
    scale = RangeScale*average[14,1](abs(close-close[1]))//2.338
    
    endif
    
    r = average[27,1](scale)
    
    HH = close
    LL = close
    
    if 1 <> 1 then
    HH = high
    LL = low
    endif
    
    if 1 = 1 then
    if HH > RRange[1] then
    if (HH-R) < RRange[1] then
    RRange = RRange[1]
    else
    RRange = (HH-R)
    endif
    elsif (LL+R) > RRange[1] then
    RRange = RRange[1]
    else
    RRange = (LL+R)
    endif
    
    else
    if HH >= (RRange[1]+R) then
    RRange = (RRange[1]) + (abs (HH - (RRange[1]) )/ R)*R
    elsif LL <= (RRange[1]-R) then
    RRange = (RRange[1]) - (abs (LL - (RRange[1]) )/ R)*R
    else
    RRange = RRange[1]
    endif
    endif
    
    UpRange    = RRange + R
    DwRange    = RRange - R
    
    if RRange > RRange[1] then
    upward = 1
    downward = 0
    endif
    if RRange < RRange[1] then
    upward = 0
    downward = 1
    endif
    
    Trend = RRange
    TrendMedium = average[2](Trend)
    TrendLong= average[3](Trend)
    ForceINT = (close+Trend)/2
    
    
    MidPLH = Trend + (UpRange - Trend)/2
    MidPLB = Trend - (Trend - DwRange)/2
    
    //
    //=/===============/=//=/===============/=//=/ Trend Color
    //
    
    //=/ Trend Color Settings
    if upward > 0 and Trend > Trend[1] then
    UPTrend = 1
    DWTrend = 0
    cr = RxUP
    cg = GxUP
    cb = BxUP
    ct = 250
    
    elsif downward > 0 and Trend < Trend[1] then
    UPTrend = 0
    DWTrend = 1
    cr = RxDOWN
    cg = GxDOWN
    cb = BxDOWN
    ct = 250
    
    elsif upward > 0 and Trend = Trend[1] then
    UPTrend = 0
    DWTrend = 0
    cr = RxUP
    cg = GxUP
    cb = BxUP
    ct = 250
    
    elsif downward > 0 and Trend = Trend[1] then
    UPTrend = 0
    DWTrend = 0
    cr = RxDOWN
    cg = GxDOWN
    cb = BxDOWN
    ct = 250
    
    endif
    
    //
    //=/===============/=//=/===============/=//=/ ForceINT Color
    //
    
    //=/ ForceINT Color Settings
    if upward > 0 and ForceINT => MID4 then
    fr = RxForce
    fg = GxForce
    fb = BxForce
    ft = 250
    
    elsif downward > 0 and ForceINT =< MID11 then
    fr = RxForce
    fg = GxForce
    fb = BxForce
    ft = 250
    
    elsif upward > 0 and ForceINT < MID4 then
    fr = RxUP
    fg = GxUP
    fb = BxUP
    ft = 250
    
    elsif downward > 0 and ForceINT > MID11 then
    fr = RxDOWN
    fg = GxDOWN
    fb = BxDOWN
    ft = 250
    
    endif
    
    //
    //=/===============/=//=/===============/=//=/ Candle
    //
    
    //=/ Bullish Conditions 1
    UP1 = UpWard > 0
    UP2 = UPTrend > 0
    UP3 = low =< ForceINT
    BullishConditions1 = UP1 and UP2 and UP3
    
    //=/ Bullish Conditions 2
    UPX1 = UpWard > 0
    UPX2 = UPTrend > 0
    UPX3 = low > ForceINT
    BullishConditions2 = UPX1 and UPX2 and UPX3
    
    //=/ Bullish Conditions 3
    UPXX1 = UpWard > 0
    UPXX2 = Trend = Trend[1]
    UPXX3 = TrendMedium > TrendMedium[1]
    UPXX4 = close > MidPLH
    BullishConditions3 = UPXX1 and UPXX2 and UPXX3 and UPXX4
    
    //=/ Bullish Conditions 4
    UPXXX1 = UpWard > 0
    UPXXX2 = Trend = Trend[1]
    UPXXX3 = TrendMedium = TrendMedium[1]
    UPXXX4 = TrendLong > TrendLong[1]
    UPXXX5 = close > MidPLH
    BullishConditions4 = UPXXX1 and UPXXX2 and UPXXX3 and UPXXX4 and UPXXX5
    
    //=/ Bullish Conditions R
    UPR1 = UpWard > 0
    UPR2 = Close < Trend
    BullishConditionsR = UPR1 and UPR2
    
    //=//=//
    
    //=/ Bearish Conditions 1
    EP1 = DownWard > 0
    EP2 = DWTrend > 0
    EP3 = high => ForceINT
    BearishConditions1 = EP1 and EP2 and EP3
    
    //=/ Bearish Conditions 2
    EPX1 = DownWard > 0
    EPX2 = DWTrend > 0
    EPX3 = high < ForceINT
    BearishConditions2 = EPX1 and EPX2 and EPX3
    
    //=/ Bearish Conditions 3
    EPXX1 = DownWard > 0
    EPXX2 = Trend = Trend[1]
    EPXX3 = TrendMedium < TrendMedium[1]
    EPXX4 = close < MidPLB
    BearishConditions3 = EPXX1 and EPXX2 and EPXX3 and EPXX4
    
    //=/ Bearish Conditions 4
    EPXXX1 = DownWard > 0
    EPXXX2 = Trend = Trend[1]
    EPXXX3 = TrendMedium = TrendMedium[1]
    EPXXX4 = TrendLong < TrendLong[1]
    EPXXX5 = close < MidPLB
    BearishConditions4 = EPXXX1 and EPXXX2 and EPXXX3 and EPXXX4 and EPXXX5
    
    //=/ Bearish Conditions R
    EPR1 = DownWard > 0
    EPR2 = Close > Trend
    BearishConditionsR = EPR1 and EPR2
    
    //=/ Candle Color Settings
    if BullishConditions1 then
    R = RxUP
    G = GxUP
    B = BxUP
    T = 250
    
    elsif BullishConditions2 then
    R = RxUP
    G = GxUP
    B = BxUP
    T = 200
    
    elsif BullishConditions3 then
    R = RxUP
    G = GxUP
    B = BxUP
    T = 200
    
    elsif BullishConditions4 then
    R = RxUP
    G = GxUP
    B = BxUP
    T = 200
    
    elsif BullishConditionsR then
    R = RxRange
    G = GxRange
    B = BxRange
    T = 150
    
    //=//=//
    elsif BearishConditions1 then
    R = RxDOWN
    G = GxDOWN
    B = BxDOWN
    T = 250
    
    elsif BearishConditions2 then
    R = RxDOWN
    G = GxDOWN
    B = BxDOWN
    T = 200
    
    elsif BearishConditions3 then
    R = RxDOWN
    G = GxDOWN
    B = BxDOWN
    T = 200
    
    elsif BearishConditions4 then
    R = RxDOWN
    G = GxDOWN
    B = BxDOWN
    T = 200
    
    elsif BearishConditionsR then
    R = RxRange
    G = GxRange
    B = BxRange
    T = 150
    
    //=//=//
    
    else
    R = 204
    G = 204
    B = 204
    T = 250
    endif
    
    drawcandle(open,high,low,close) coloured(R,G,B,T)
    
    //
    //=/===============/=//=/===============/=//=/ End
    //
    
    //
    //=/===============/=//=/===============/=//=/ Visual
    //
     
    //=/ Visual Settings
    MIDX1 = (UpRange-Trend)/8
    MID1 = (Trend+MIDX1)
    MID2 = (MID1+MIDX1)
    MID3 = (MID2+MIDX1)
    MID4 = (MID3+MIDX1)
    MID5 = (MID4+MIDX1)
    MID6 = (MID5+MIDX1)
    MID7 = (MID6+MIDX1)
     
    MIDX2 = (Trend-DwRange)/8
    MID8 = (Trend-MIDX2)
    MID9 = (MID8-MIDX2)
    MID10 = (MID9-MIDX2)
    MID11 = (MID10-MIDX2)
    MID12 = (MID11-MIDX2)
    MID13 = (MID12-MIDX2)
    MID14 = (MID13-MIDX2)
    
    return Trend coloured (cr,cg,cb,ct) style(line,2) as "Trend", ForceINT coloured (fr,fg,fb,ft) style(line,1) as "ForceINT", UpRange coloured (RxUP,GxUP,BxUP,15) style(line,1) as "UpRange", DwRange coloured (RxUP,GxUP,BxUP,15) style(line,1) as "DwRange", MID1 coloured (RxUP,GxUP,BxUP,150) style(line,1) as "MID1", MID2 coloured (RxUP,GxUP,BxUP,130) style(line,1) as "MID2", MID3 coloured (RxUP,GxUP,BxUP,110) style(line,1) as "MID3", MID4 coloured (RxUP,GxUP,BxUP,90) style(line,1) as "MID4", MID5 coloured (RxUP,GxUP,BxUP,70) style(line,1) as "MID5", MID6 coloured (RxUP,GxUP,BxUP,50) style(line,1) as "MID6", MID7 coloured (RxUP,GxUP,BxUP,30) style(line,1) as "MID7", MID8 coloured (RxDOWN,GxDOWN,BxDOWN,150) style(line,1) as "MID8", MID9 coloured (RxDOWN,GxDOWN,BxDOWN,130) style(line,1) as "MID9", MID10 coloured (RxDOWN,GxDOWN,BxDOWN,110) style(line,1) as "MID10", MID11 coloured (RxDOWN,GxDOWN,BxDOWN,90) style(line,1) as "MID11", MID12 coloured (RxDOWN,GxDOWN,BxDOWN,70) style(line,1) as "MID12", MID13 coloured (RxDOWN,GxDOWN,BxDOWN,50) style(line,1) as "MID13", MID14 coloured (RxDOWN,GxDOWN,BxDOWN,30) style(line,1) as "MID14"
    
    Luciole, PLermite and Moda thanked this post
    Impluse-Trend.itf Capture.png Capture.png
    #149828 quote
    ullle73
    Participant
    Senior

    in a nutshell, buy when candles turn blue? go short when black?

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

Trend Impulse with Range Filter V2


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by ullle73
5 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/02/2020
Status: Active
Attachments: 4 files
Logo Logo
Loading...