BuySell Indicator For MT5
Table Of Contents:
- BuySell Indicator For MT5
- Installing the BuySell Indicator For MT5
- Parameters of the BuySell Indicator For MT5
- Buffers of the BuySell Indicator For MT5
- Main Parts Of The Code
The BuySell Indicator For MT5 shows the dynamic support and resistance zone in the price chart with simple dots. But if you carefully observe the price chart, you will often notice a small magenta color square above the candlestick and this means you need to get ready for the downtrend. On the contrary, when you spot a blue square below the candlestick, you should be ready for the bullish rally. To trade the market by using this tool, you need to learn to analyze the support and resistance level. Some traders often use the dots and square mark to exit from profitable trades since the indicator also calculates the ATR value while plotting this dots and square.
Installing the BuySell 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 buysell.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 BuySell Indicator For MT5
The BuySell Indicator For MT5 has 4 parameters to configure.
input uint MA_Period=14; input ENUM_MA_METHOD MA_Method=MODE_SMA; // Smoothing method input ENUM_APPLIED_PRICE MA_Price=PRICE_CLOSE; // Price input uint ATR_Period=60;
Buffers of the BuySell Indicator For MT5
The BuySell Indicator For MT5 provides 4 buffers.
SetIndexBuffer(0,UpBuffer,INDICATOR_DATA); SetIndexBuffer(1,DnBuffer,INDICATOR_DATA); SetIndexBuffer(2,SellBuffer,INDICATOR_DATA); SetIndexBuffer(3,BuyBuffer,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 &tick_volume[], const long &volume[], const int &spread[]) { //---- checking of bars, needed for calculation if(BarsCalculated(MA_Handle) lt rates_total || BarsCalculated(ATR_Handle) lt rates_total || rates_total lt min_rates_total) return(RESET); //---- declaration of local variables int limit,to_copy,bar; double MA[],ATR[]; //---- set starting bar index limit if(prev_calculated gt rates_total || prev_calculated lt =0)// checking of first call limit=rates_total-min_rates_total-2; // starting bar index for all bars else limit=rates_total-prev_calculated; // starting bar index for new bars to_copy=limit+2; //---- copy new data to arrays if(CopyBuffer(MA_Handle,0,0,to_copy,MA) lt =0) return(RESET); if(CopyBuffer(ATR_Handle,0,0,to_copy,ATR) lt =0) return(RESET); //---- set indexing as time series ArraySetAsSeries(MA,true); ArraySetAsSeries(ATR,true); //---- first calculation for(bar=limit; bar gt =0 && !IsStopped(); bar--) { //---- set buffers to zero DnBuffer[bar]=0.0; UpBuffer[bar]=0.0; if(MA[bar] gt MA[bar+1]) DnBuffer[bar]=MA[bar]-ATR[bar]; if(MA[bar] lt MA[bar+1]) UpBuffer[bar]=MA[bar]+ATR[bar]; } //---- recalculation of starting bar index for new bars if(prev_calculated gt rates_total || prev_calculated lt =0)// checking of first call limit--; //---- second calculation for(bar=limit; bar gt =0 && !IsStopped(); bar--) { //---- set buffers to zero BuyBuffer[bar]=0.0; SellBuffer[bar]=0.0; if(UpBuffer[bar+1]&&DnBuffer[bar]) BuyBuffer [bar]=DnBuffer[bar]; if(DnBuffer[bar+1]&&UpBuffer[bar]) SellBuffer[bar]=UpBuffer[bar]; } //---- return(rates_total); } //+------------------------------------------------------------------+