Page 1903 of 2170

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 1:28 am
by mrtools
JB4417 wrote: Fri Jul 28, 2023 6:17 am Is there a script or any other way to rearrange your indicator subwindows without having to delete the indicators and replace them back on the chart? This seems like a simple thing that should be in Mt4
Do your chart how you want it and save as template name, then you can pull up any chart you want then click on your template.

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 2:40 am
by yrango
hi coders
can someone please help me to put alerts to this indicator ?
alerts when candle close and arrow show buy - sell with options for alert on closed candle or no .
thank you for your help

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 4:45 am
by Jedidiah
Dear Mr.Tools, please help me to add the button. . I can't add it myself. . .
gratitude

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 4:53 am
by mrtools
yrango wrote: Sat Jul 29, 2023 2:40 am hi coders
can someone please help me to put alerts to this indicator ?
alerts when candle close and arrow show buy - sell with options for alert on closed candle or no .
thank you for your help
Alerts would be very deceiving on that indicator since it repaints.

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 4:59 am
by kvak
Jedidiah wrote: Sat Jul 29, 2023 4:45 am Dear Mr.Tools, please help me to add the button. . I can't add it myself. . .
gratitude
Hello, is not THIS same?

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 5:01 am
by Jedidiah
kvak wrote: Sat Jul 29, 2023 4:59 am Hello, is not THIS same?
Thanks Dear kvak, please forgive me for not knowing that a button version already exists. .

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 5:12 am
by mrtools
Jedidiah wrote: Sat Jul 29, 2023 4:45 am Dear Mr.Tools, please help me to add the button. . I can't add it myself. . .
gratitude
Posted it here

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 5:50 am
by yrango
mrtools wrote: Sat Jul 29, 2023 4:53 am Alerts would be very deceiving on that indicator since it repaints.
pls i need alerts and wana test something i know indicator repaint
i was try to add alerts but i cant all its fine with code but no alerts idk why

Re: MT4 Indicator requests and ideas

Posted: Sat Jul 29, 2023 6:46 am
by mrtools
yrango wrote: Sat Jul 29, 2023 5:50 am pls i need alerts and wana test something i know indicator repaint
i was try to add alerts but i cant all its fine with code but no alerts idk why
Probably a version in this thread already.

Relative Trend Index MT4 Indicator request

Posted: Sat Jul 29, 2023 10:52 am
by TransparentTrader
[TRADINGVIEW] "Relative Trend Index" (RTI) by Zeiierman

I've seen this indicator blow up on TradingView and become immensely popular. But after seeing Xard777's tease of the latest iteration of his system, I think it's high time we got this indicator coded for MT4.

I don't want to give the URL for the TradingView website itself because I'll get kicked off this forum if I put in a link directed to an external website again (currently skating on thin ice right now).

At the same time, the description for this indicator is way too long for me to paste in its entirety.

So I'll paste what I believe is the most relevant part and the rest is up to you to read for yourself.

The RSI is a momentum oscillator that measures the speed and change of price movements and is typically used to identify overbought and oversold conditions in a market. However, its primary limitation lies in its tendency to produce false signals during extended trending periods.

On the other hand, the RTI is designed specifically to identify and adapt to market trends. Instead of solely focusing on price changes, the RTI measures the relative positioning of the current closing price within its recent range, providing a more comprehensive view of market conditions.

The RTI's adaptable nature is particularly valuable. The user-adjustable sensitivity percentage allows traders to fine-tune the indicator's responsiveness, making it more resilient to sudden market fluctuations and noise that could otherwise produce false signals. This feature is advantageous in various market conditions, from trending to choppy and sideways-moving markets.

Furthermore, the RTI's unique method of defining OB/OS zones takes into account the prevailing trend, which can provide a more precise reflection of the market's condition.

While the RSI is an invaluable tool in many traders' toolkits, the RTI's unique approach to trend identification, adaptability, and enhanced definition of OB/OS zones can provide traders with a more nuanced understanding of market conditions and potential trading opportunities. This makes the RTI an especially powerful tool for those seeking to ride long-term trends and avoid false signals.


Despite the lengthy description, the code is only 73 lines long.

Code: Select all

// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © Zeiierman
//@version=5
indicator('Relative Trend Index (RTI) by Zeiierman', shorttitle= "RTI", overlay=false, precision=0)

// Inputs {
trend_data_count             = input.int(100, step=4, minval=10, title="Trend Length", inline = "RT", group="Relative Trend Index [RTI]", tooltip="This variable determines the number of data points used in the calculation. \n\nIn short: A high value returns the long-term trend and a low value returns the short-term trend. \n\nIf a user increases the 'Trend Length', the trend will take into account a larger number of data points. This makes the trends smoother and more resistant to sudden changes in the market, as they're based on a broader set of data. It  also makes the trends slower to react to recent changes, as they're diluted by older data. \n\nOn the other hand, if a user decreases the 'Trend Length', the trend will take into account fewer data points. This could make the trends more responsive to recent market changes, as they're based on a narrower set of data. It also makes the trends more susceptible to noise and rapid fluctuations, as each new piece of data has a greater impact.")
trend_sensitivity_percentage = input.int(95, step=1,minval=50, maxval=98,title='Sensitivity    ', inline = "RT1", group="Relative Trend Index [RTI]", tooltip="This variable determines the specific indices in the sorted trend arrays that are used for the upper and lower trend. It's used as a percentage of the 'Trend length'. \n\nIf a user increases the 'Sensitivity', the trend will be based on higher and lower positions in the sorted arrays, respectively. This makes the trend less sensitive.  \n\nConversely, if a user decreases the 'Sensitivity', the trend will be based on positions closer to the middle of the sorted arrays. This makes the trend more sensitive.")
signal_length                = input.int(20, step=1,minval=1, maxval=200,title='Signal Length', inline = "", group="Signal Line", tooltip="Set the Ma period.")
ob  = input.float(80, step=1, minval=0, maxval=100, title="", inline = "obos", group="Overbought/Oversold", tooltip="")
os  = input.float(20,step=1, minval=0, maxval=100,title="", inline = "obos", group="Overbought/Oversold", tooltip="Set the OB/OS levels.")
//~~~~~~~~~~~~~~~~~~~~~~~}

// Relative Trend Index Calculation {
upper_trend = close + ta.stdev(close, 2)
lower_trend = close - ta.stdev(close, 2)

upper_array = array.new<float>(0)
lower_array = array.new<float>(0)
for i = 0 to trend_data_count - 1 
    upper_array.push(upper_trend[i])
    lower_array.push(lower_trend[i])
upper_array.sort()
lower_array.sort()

upper_index  = math.round(trend_sensitivity_percentage / 100 * trend_data_count) - 1
lower_index  = math.round((100 - trend_sensitivity_percentage) / 100 * trend_data_count) - 1
UpperTrend   = upper_array.get(upper_index)
LowerTrend   = lower_array.get(lower_index)
RelativeTrendIndex = ((close - LowerTrend) / (UpperTrend - LowerTrend))*100
//~~~~~~~~~~~~~~~~~~~~~~~}

// Plots {
MA_RelativeTrendIndex = ta.ema(RelativeTrendIndex,signal_length)
RT = plot(RelativeTrendIndex, 'Relative Trend Index (RTI)', color=color.new(color.teal, 0))
plot(MA_RelativeTrendIndex, 'Ma Relative Trend Index', color=color.new(#00bcd4, 0))
//~~~~~~~~~~~~~~~~~~~~~~~}

// Line plots {
mid           = hline(50, 'Mid', color=#606060, linestyle=hline.style_dashed)
overbought    = hline(ob, 'Overbought', color=#606060, linestyle=hline.style_dashed)
oversold      = hline(os, 'Oversold', color=#606060, linestyle=hline.style_dashed)
//~~~~~~~~~~~~~~~~~~~~~~~}

// BG Fill {
fill(overbought, oversold, color=color.new(color.teal, 90), title='Background')
//~~~~~~~~~~~~~~~~~~~~~~~}

// Overbought/Oversold Gradient Fill {
midLinePlot = plot(50, color = na, editable = false, display = display.none)
fill(RT, midLinePlot, 100, ob, top_color = color.new(color.green, 0), bottom_color = color.new(color.green, 100),  title = "Overbought Gradient Fill")
fill(RT, midLinePlot, os,  0,  top_color = color.new(color.red, 100), bottom_color = color.new(color.red, 0),      title = "Oversold Gradient Fill")
//~~~~~~~~~~~~~~~~~~~~~~~}

//Alerts {
RT_OB_Over   = ta.crossover(RelativeTrendIndex,ob)
RT_OB_Under  = ta.crossunder(RelativeTrendIndex,ob)
RT_OS_Over   = ta.crossover(RelativeTrendIndex,os)
RT_OS_Under  = ta.crossunder(RelativeTrendIndex,os)
RT_Mid_Over  = ta.crossover(RelativeTrendIndex,50)
RT_Mid_Under = ta.crossunder(RelativeTrendIndex,50)
RT_MA_Over   = ta.crossover(RelativeTrendIndex,MA_RelativeTrendIndex)
RT_MA_Under  = ta.crossunder(RelativeTrendIndex,MA_RelativeTrendIndex)

alertcondition(RT_OB_Over,  title = "RTI Crossover OB",  message = "RTI Crossover OB")
alertcondition(RT_OB_Under, title = "RTI Crossunder OB", message = "RTI Crossunder OB")
alertcondition(RT_OS_Over,  title = "RTI Crossover OS",  message = "RTI Crossover OS")
alertcondition(RT_OS_Under, title = "RTI Crossunder OS", message = "RTI Crossunder OS")
alertcondition(RT_Mid_Over, title = "RTI Crossover 50",  message = "RTI Crossover 50")
alertcondition(RT_Mid_Under,title = "RTI Crossunder 50", message = "RTI Crossunder 50")
alertcondition(RT_MA_Over,  title = "RTI Crossover Ma",  message = "RTI Crossover Ma")
alertcondition(RT_MA_Under, title = "RTI Crossunder Ma", message = "RTI Crossunder Ma")

kvak, mrtools, or any of the legacy programmers on the forum, would it be possible to port the RTI in its entirety for MT4? I think this indicator request, if fulfilled, would make Xard777 a very happy man!