DT Oscillator Indicator For MT5
Table Of Contents:
- DT Oscillator Indicator For MT5
- Installing the DT Oscillator Indicator For MT5
- Parameters of the DT Oscillator Indicator For MT5
- Buffers of the DT Oscillator Indicator For MT5
- Main Parts Of The Code
The DT Oscillator Indicator For MT5 is based on the work of Rober Miner. It looks similar to the stochastic indicator. The indicator also draws two lines on an oscillator subwindow which swing between the 0 and 100 levels. You can use the 70 level to detect overbought conditions and the 30 level to detect oversold conditions. You can also use the crossing of the two lines for confirmation before you decide to initiate a trade.
Installing the DT Oscillator Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file dt_oscillator.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the DT Oscillator Indicator For MT5
The DT Oscillator Indicator For MT5 has 5 parameters to configure.
input int RsiPeriod = 13; // Rsi period input int StochPeriod = 8; // Stochastic period input int SlowingPeriod = 5; // Slowing input int SignalPeriod = 3; // Signal period input bool TapeVisible = true; // Tape visibility
Buffers of the DT Oscillator Indicator For MT5
The DT Oscillator Indicator For MT5 provides 4 buffers.
SetIndexBuffer( 0,dtosf1,INDICATOR_DATA); SetIndexBuffer( 1,dtosf2,INDICATOR_DATA); SetIndexBuffer( 2,dtosc ,INDICATOR_DATA); SetIndexBuffer( 3,dtoss ,INDICATOR_DATA);
Main Parts Of The Code
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 &TickVolume[], const long &Volume[], const int &Spread[]) { // // // // // if (ArraySize(rsibuf)!=rates_total) ArrayResize(rsibuf,rates_total); if (ArraySize(stobuf)!=rates_total) ArrayResize(stobuf,rates_total); // // // // // for (int i=(int)MathMax(prev_calculated-1,0); i lt rates_total; i++) { rsibuf[i] = iRsi(Close[i],RsiPeriod,i,rates_total); double min = rsibuf[i]; double max = rsibuf[i]; for (int k=1; k lt StochPeriod && (i-k) gt =0; k++) { min = MathMin(rsibuf[i-k],min); max = MathMax(rsibuf[i-k],max); } if (max!=min) stobuf[i] = 100*(rsibuf[i]-min)/(max-min); else stobuf[i] = 0; // // // // // dtosc[i] = 0; for (int k=0; k lt SlowingPeriod && (i-k) gt =0; k++) dtosc[i] += stobuf[i-k]; dtosc[i] /= SlowingPeriod; dtoss[i] = 0; for (int k=0; k lt SignalPeriod && (i-k) gt =0; k++) dtoss[i] += dtosc[i-k]; dtoss[i] /= SignalPeriod; if (TapeVisible) { dtosf1[i] = dtosc[i]; dtosf2[i] = dtoss[i]; } else { dtosf1[i] = EMPTY_VALUE; dtosf2[i] = EMPTY_VALUE; } } // // // // // return(rates_total); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // double rsiWork[][3]; #define _price 0 #define _chgAvg 1 #define _totChg 2 // // // // // double iRsi(double price, double period, int i, int bars) { if (ArrayRange(rsiWork,0)!=bars) ArrayResize(rsiWork,bars); // // // // // // rsiWork[i][_price] = price; if (i==0) { rsiWork[i][_chgAvg] = 0; rsiWork[i][_totChg] = 0; return(50); } // // // // // double sf = 1.0 / period; double change = rsiWork[i][_price]-rsiWork[i-1][_price]; rsiWork[i][_chgAvg] = rsiWork[i-1][_chgAvg] + sf*( change -rsiWork[i-1][_chgAvg]); rsiWork[i][_totChg] = rsiWork[i-1][_totChg] + sf*(MathAbs(change)-rsiWork[i-1][_totChg]); double changeRatio = (rsiWork[i][_totChg]!=0 ? rsiWork[i][_chgAvg]/rsiWork[i][_totChg] : 0 ); return(50.0*(changeRatio+1.0)); }