Can you please explain more clearly.
help me for buffer and mode of level line of RSI indicator
Help you in what way?
Hello
Can anybody help me for buffer and mode of level line of RSI indicator (for example 30 and 70 at default)
Thanks
Set them here:
Or set in the standard RSI indicator's code by the highlighted lines:
//+------------------------------------------------------------------+ //| RSI.mq4 | //| Copyright 2005-2014, MetaQuotes Software Corp. | //| https://www.mql4.com | //+------------------------------------------------------------------+ #property copyright "2005-2014, MetaQuotes Software Corp." #property link "https://www.mql4.com" #property description "Relative Strength Index" #property strict #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_buffers 1 #property indicator_color1 DodgerBlue #property indicator_level1 30.0 #property indicator_level2 70.0 #property indicator_levelcolor clrSilver #property indicator_levelstyle STYLE_DOT //--- input parameters input int InpRSIPeriod=14; // RSI Period //--- buffers double ExtRSIBuffer[]; double ExtPosBuffer[]; double ExtNegBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit(void) { string short_name; //--- 2 additional buffers are used for counting. IndicatorBuffers(3); SetIndexBuffer(1,ExtPosBuffer); SetIndexBuffer(2,ExtNegBuffer); //--- indicator line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtRSIBuffer); //--- name for DataWindow and indicator subwindow label short_name="RSI("+string(InpRSIPeriod)+")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //--- check for input if(InpRSIPeriod<2) { Print("Incorrect value for input variable InpRSIPeriod = ",InpRSIPeriod); return(INIT_FAILED); } //--- SetIndexDrawBegin(0,InpRSIPeriod); //--- initialization done return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Relative Strength Index | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int i,pos; double diff; //--- if(Bars<=InpRSIPeriod || InpRSIPeriod<2) return(0); //--- counting from 0 to rates_total ArraySetAsSeries(ExtRSIBuffer,false); ArraySetAsSeries(ExtPosBuffer,false); ArraySetAsSeries(ExtNegBuffer,false); ArraySetAsSeries(close,false); //--- preliminary calculations pos=prev_calculated-1; if(pos<=InpRSIPeriod) { //--- first RSIPeriod values of the indicator are not calculated ExtRSIBuffer[0]=0.0; ExtPosBuffer[0]=0.0; ExtNegBuffer[0]=0.0; double sump=0.0; double sumn=0.0; for(i=1; i<=InpRSIPeriod; i++) { ExtRSIBuffer[i]=0.0; ExtPosBuffer[i]=0.0; ExtNegBuffer[i]=0.0; diff=close[i]-close[i-1]; if(diff>0) sump+=diff; else sumn-=diff; } //--- calculate first visible value ExtPosBuffer[InpRSIPeriod]=sump/InpRSIPeriod; ExtNegBuffer[InpRSIPeriod]=sumn/InpRSIPeriod; if(ExtNegBuffer[InpRSIPeriod]!=0.0) ExtRSIBuffer[InpRSIPeriod]=100.0-(100.0/(1.0+ExtPosBuffer[InpRSIPeriod]/ExtNegBuffer[InpRSIPeriod])); else { if(ExtPosBuffer[InpRSIPeriod]!=0.0) ExtRSIBuffer[InpRSIPeriod]=100.0; else ExtRSIBuffer[InpRSIPeriod]=50.0; } //--- prepare the position value for main calculation pos=InpRSIPeriod+1; } //--- the main loop of calculations for(i=pos; i<rates_total && !IsStopped(); i++) { diff=close[i]-close[i-1]; ExtPosBuffer[i]=(ExtPosBuffer[i-1]*(InpRSIPeriod-1)+(diff>0.0?diff:0.0))/InpRSIPeriod; ExtNegBuffer[i]=(ExtNegBuffer[i-1]*(InpRSIPeriod-1)+(diff<0.0?-diff:0.0))/InpRSIPeriod; if(ExtNegBuffer[i]!=0.0) ExtRSIBuffer[i]=100.0-100.0/(1+ExtPosBuffer[i]/ExtNegBuffer[i]); else { if(ExtPosBuffer[i]!=0.0) ExtRSIBuffer[i]=100.0; else ExtRSIBuffer[i]=50.0; } } //--- return(rates_total); } //+------------------------------------------------------------------+
or
IndicatorSetDouble(INDICATOR_LEVELVALUE,0,30); IndicatorSetDouble(INDICATOR_LEVELVALUE,1,70);
Thanks for your answer
I need use it in my EA for example when
ExtPosBuffer
go under 30 line or any other custom line??
and is it true blue line mode ExtPosBuffer and buffer 1
and red line mode ExtNegBuffer and buffer 2 ?
Thanks again
Thanks so much , this is work i think
but why i use
(iStochastic(_Symbol,PERIOD_CURRENT,5,3,3,MODE_SMA,STO_LOWHIGH,0)<20)
as insdroduction https://www.mql5.com/en/docs/indicators/istochastic and like your code compiler has error!
and another question how can i use this method for another indicator that don't have anyhthing like these indicator https://www.mql5.com/en/docs/indicators
Thanks again
- www.mql5.com
and how can i use fall or rise line with degree!
for example in Stochastic say if blue line over red line and under 30 and both rise with over 10^ do it ...
?
is this true for blue line over red ?
double indi_5_Lo(string iCustomName, int iCustomMode, string SYMBOL, ENUM_TIMEFRAMES TIMEFRAME, int SHIFT) { double retval=iCustom(SYMBOL,TIMEFRAME,"Stochastic", "ExtHighesBuffer" ,2,0); return(retval); } double indi_5_Ro(string iCustomName, int iCustomMode, string SYMBOL, ENUM_TIMEFRAMES TIMEFRAME, int SHIFT) { double retval=iCustom(SYMBOL,TIMEFRAME,"Stochastic", "ExtLowesBuffer" ,3,0); return(retval); } if (indi_5_Lo>indi_5_Ro)
and what i should do for another questions ?
Thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
Can anybody help me for buffer and mode of level line of RSI indicator (for example 30 and 70 at default)
Thanks