Page 166 of 281

Re: RSI Indicators for MT4

Posted: Thu Aug 19, 2021 11:52 am
by RplusT
This experimental study attempts to translate Relative Strength Index ( RSI ) threshold levels of oversold/overbought and bull/bear zones as probable Price Support and Resistance levels.
Could this be translated into an MT4 Indicator?


Code: Select all

//@version=4
study('RSI Support & Resistance by DGT', 'RSI S&R ʙʏ DGT ☼☾', true)

i_source       = input("Price (close)", 'Source', options = ["Price (close)", "On Balance Volume (OBV)"], inline = 'RSI', group = 'RSI Settings')
i_length       = input(14, '  Length' , minval=1                                                        , inline = 'RSI', group = 'RSI Settings')
i_obThreshold  = input(70, 'Overboght', minval=50, maxval=100, inline = 'Thresh1', group = 'Threshold Settings') 
i_bullZone     = input(60, 'Bull Zone', minval=50, maxval=65 , inline = 'Thresh1', group = 'Threshold Settings') 
i_bearZone     = input(40, 'Bear Zone', minval=35, maxval=50 , inline = 'Thresh2', group = 'Threshold Settings')  
i_osThreshold  = input(30, 'Oversold' , minval=1 , maxval=50 , inline = 'Thresh2', group = 'Threshold Settings')  

i_owcb         = input(true , 'RSI Weighted Colored Bars'    , group = 'Optional')
i_obos         = input(false, 'RSI Overbought/Oversold Marks', group = 'Optional')
i_fill         = input(true , 'Backgroud of Bull/Bear Zones' , group = 'Optional')

// Functions ════════════════════════════════════════════════════════════════════════════════════ //

f_getPrice(_osc, _thresh, _cross) =>
    avgHigh = avg(high, close)
    avgLow  = avg(low , close)
    
    var return = 0.

    if _cross == 'over'  or _cross == 'both'
        if crossover(_osc, _thresh)
            return := avgHigh
    if _cross == 'under' or _cross == 'both'
        if crossunder(_osc, _thresh)
            return := avgLow
    return

// -Calculations ════════════════════════════════════════════════════════════════════════════════ //

oscillator            = rsi(i_source == "Price (close)" ? close : obv, i_length)
crossover_overbought  = f_getPrice(oscillator, i_obThreshold, 'over' )
crossunder_overbought = f_getPrice(oscillator, i_obThreshold, 'under')
bullZone              = f_getPrice(oscillator, i_bullZone   , 'both' )
bearZone              = f_getPrice(oscillator, i_bearZone   , 'both' )
crossover_oversold    = f_getPrice(oscillator, i_osThreshold, 'over' )
crossunder_oversold   = f_getPrice(oscillator, i_osThreshold, 'under')

// -Plotting ════════════════════════════════════════════════════════════════════════════════════ //

plot_crossover_overbought  = plot(crossover_overbought  > 0 ? crossover_overbought  : na, 'Crossover Overbought' , crossover_overbought  == crossover_overbought[1]  ? color.green : na, 2)
plot_crossunder_overbought = plot(crossunder_overbought > 0 ? crossunder_overbought : na, 'Crossunder Overbought', crossunder_overbought == crossunder_overbought[1] ? color.green : na, 1, plot.style_cross)
plot_bullZone              = plot(bullZone              > 0 ? bullZone              : na, 'Cross Bull Zone'      , bullZone              == bullZone[1]              ? color.green : na, 1)

fill(plot_crossover_overbought, plot_bullZone, i_fill ? color.green : na)
plotshape(i_obos and oscillator > i_obThreshold, "Price Bars in Overbought Zone", shape.triangledown, location.abovebar, color.red, size=size.tiny)

plot_bearZone            = plot(bearZone            > 0 ? bearZone            : na, 'Cross Bear Zone'    , bearZone            == bearZone[1]            ? color.red : na, 1)
plot_crossover_oversold  = plot(crossover_oversold  > 0 ? crossover_oversold  : na, 'Crossover Oversold' , crossover_oversold  == crossover_oversold[1]  ? color.red : na, 1, plot.style_cross)
plot_crossunder_oversold = plot(crossunder_oversold > 0 ? crossunder_oversold : na, 'Crossunder Oversold', crossunder_oversold == crossunder_oversold[1] ? color.red : na, 2)

fill(plot_crossunder_oversold, plot_bearZone, i_fill ? color.red : na)
plotshape(i_obos and oscillator < i_osThreshold, "Price Bars in Oversold Zone", shape.triangleup, location.belowbar, color.green, size=size.tiny)

barcolor(i_owcb ? oscillator > i_obThreshold or oscillator < i_osThreshold ? close < open ? #910000      : #006400 : 
                  oscillator > i_bearZone    and oscillator < i_bullZone   ? close < open ? color.orange : #7FFFD4 : na : na, title="RSI Weighted Colored Bars")

// -Alerts   ════════════════════════════════════════════════════════════════════════════════════ //

alertcondition(crossover (close, crossover_overbought), "Crossover Previous Overbought", "Crossover Previous Overbought\n{{exchange}}:{{ticker}}->\nPrice = {{close}},\nTime = {{time}}")
alertcondition(crossunder(close, crossunder_oversold ), "Crossunder Previous Oversold" , "Crossunder Previous Oversold\n{{exchange}}:{{ticker}}->\nPrice = {{close}},\nTime = {{time}}")

Re: RSI Indicators for MT4

Posted: Thu Aug 19, 2021 3:30 pm
by josi
RplusT wrote: Thu Aug 19, 2021 11:52 am This experimental study attempts to translate Relative Strength Index ( RSI ) threshold levels of oversold/overbought and bull/bear zones as probable Price Support and Resistance levels.
Did you have a look at this?
viewtopic.php?p=1295421092#p1295421092

Re: RSI Indicators for MT4

Posted: Thu Aug 19, 2021 4:41 pm
by RplusT
josi wrote: Thu Aug 19, 2021 3:30 pm Did you have a look at this?
viewtopic.php?p=1295421092#p1295421092
Thanks Josi. Yes, I know this one. But I'm not sure what you mean. I'm looking for levels on the main chart.

Re: RSI Bands Fabs

Posted: Thu Aug 19, 2021 9:25 pm
by Jimmy
ionone wrote: Wed Aug 18, 2021 9:32 pm I played around a bit with the algorithm and came up with this version. Which is totally different from previous version 01

might be of use, looks good ! especially the bottom one which nails the tops and bottoms

first settings is : 20,20,false,7
second settings is : 20,20,true,-7

EDIT : this is experimental, no guarantee !
Jeff and Josi this is interesting. Check out these standard RSI settings, it creates a bit of a channel and although not as rapid, gives us some nice reversal points.

  • RSI Period: 14
  • MA Period: 20
  • invBands: False

Here's a template below. What do you think? :think:

Re: RSI Indicators for MT4

Posted: Thu Aug 19, 2021 11:52 pm
by whiplashtm
Hi!
I'm just wondering if we could have these interesting indicators, coded by mladen, updated with the latest averages and prices (and maybe some general cleanup)?
But to make the indicator even more interesting in terms of tweaking and getting different results, could we also have the option to change the average-type for each individual average?

Have a pleasent day!

Re: RSI Indicators for MT4

Posted: Fri Aug 20, 2021 3:51 am
by mrtools
whiplashtm wrote: Thu Aug 19, 2021 11:52 pm Hi!
I'm just wondering if we could have these interesting indicators, coded by mladen, updated with the latest averages and prices (and maybe some general cleanup)?
But to make the indicator even more interesting in terms of tweaking and getting different results, could we also have the option to change the average-type for each individual average?

Have a pleasent day!
Try.

Re: RSI Indicators for MT4

Posted: Mon Aug 23, 2021 7:13 am
by talaate
Hi mrtools
would you please add alerts for the given indicator when:
1) the two signal cross each other up or down
2) when RSI 50 cross up or down (i.e. histo bar shows blue or red)
and if possible the set of averages
In case the original is missed, I sent it in PM box as this is forex station stuff

Re: RSI Indicators for MT4

Posted: Mon Aug 23, 2021 12:28 pm
by mrtools
talaate wrote: Mon Aug 23, 2021 7:13 am Hi mrtools
would you please add alerts for the given indicator when:
1) the two signal cross each other up or down
2) when RSI 50 cross up or down (i.e. histo bar shows blue or red)
and if possible the set of averages
In case the original is missed, I sent it in PM box as this is forex station stuff
Rsi - histo (mtf).ex4
Added the averages and alerts.

Re: RSI Indicators for MT4

Posted: Mon Aug 23, 2021 8:12 pm
by talaate
mrtools wrote: Mon Aug 23, 2021 12:28 pm Added the averages and alerts.
Thanks Mrtools

Re: RSI Indicators for MT4

Posted: Mon Aug 23, 2021 9:45 pm
by vvFish
mrtools wrote: Mon Aug 23, 2021 12:28 pm Added the averages and alerts.
;)