Color MACD Indicator For MT5
Table Of Contents:
- Color MACD Indicator For MT5
- Εγκατάσταση του Color MACD Indicator For MT5
- Παράμετροι του Color MACD Indicator For MT5
- Buffers του Color MACD Indicator For MT5
- Κύρια μέρη του κώδικα
Ο Color MACD Indicator For MT5 σχεδιάζει μια έγχρωμη MACD στο δευτερεύον παράθυρο ιστόγραμμα. Ως ειδικό χαρακτηριστικό, μπορείτε να επιλέξετε έναν αλγόριθμο μέσου όρου / εξομάλυνσης για το MACD. Τα χρώματα του ιστογράμματος εξαρτώνται από τις τιμές. Η γραμμή σήματος είναι πράσινη στις αυξανόμενες τιμές. Στις μειούμενες τιμές, η γραμμή σήματος είναι κόκκινη.
Εγκατάσταση του Color MACD Indicator For MT5
Αφού κατεβάσετε την ένδειξη μέσω της παραπάνω φόρμας, πρέπει να αποσυνδέσετε το αρχείο zip. Στη συνέχεια, πρέπει να αντιγράψετε το αρχείο colormacd.mq5 στο φάκελο MQL5Indicators της εγκατάστασης MT5 . Στη συνέχεια, κάντε επανεκκίνηση του MT5 και, στη συνέχεια, θα μπορείτε να δείτε τον δείκτη στη λίστα των δεικτών.
Παράμετροι του Color MACD Indicator For MT5
Το Color MACD Indicator For MT5 έχει παραμέτρους 5 για να ρυθμίσετε τις παραμέτρους.
input int Fast_MA = 12; //Fast moving average period input int Slow_MA = 26; //SMMA smoothing depth input ENUM_MA_METHOD MA_Method_=MODE_EMA; //Indicator averaging method input int Signal_SMA=9; //Signal line period input Applied_price_ AppliedPrice=PRICE_CLOSE_;//Price constant
Buffers του Color MACD Indicator For MT5
Το Color MACD Indicator For MT5 παρέχει buffers 4 .
SetIndexBuffer(0,MACDBuffer,INDICATOR_DATA); SetIndexBuffer(1,ColorMACDBuffer,INDICATOR_COLOR_INDEX); SetIndexBuffer(2,SignBuffer,INDICATOR_DATA); SetIndexBuffer(3,ColorSignBuffer,INDICATOR_COLOR_INDEX);
Κύρια μέρη του κώδικα
int OnCalculate( const int rates_total, // number of bars in history at the current tick const int prev_calculated,// number of bars calculated at previous call 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 the number of bars to be enough for the calculation if(rates_total lt start) return(0); //---- Declaration of integer variables int first1,first2,first3,bar; //---- Declaration of variables with a floating point double price_,fast_ma,slow_ma; //---- Initialization of the indicator in the OnCalculate() block if(prev_calculated gt rates_total || prev_calculated lt =0)// checking for the first start of calculation of an indicator { first1=0; // starting number for calculation of all first loop bars first2=macd_start+1; // starting number for calculation of all second loop bars first3=start+1; // starting number for calculation of all third loop bars } else // starting number for calculation of new bars { first1=prev_calculated-1; first2=first1; first3=first1; } //---- declaration of variables of the CMoving_Average class from the file MASeries_Cls.mqh static CMoving_Average MA1,MA2,MA3; //---- Main loop of the indicator calculation for(bar=first1; bar lt rates_total; bar++) { price_=PriceSeries(AppliedPrice,bar,open,low,high,close); fast_ma = MA1.MASeries(0, prev_calculated, rates_total, Fast_MA, MA_Method_, price_, bar, false); slow_ma = MA2.MASeries(0, prev_calculated, rates_total, Slow_MA, MA_Method_, price_, bar, false); MACDBuffer[bar]=fast_ma-slow_ma; SignBuffer[bar]=MA3.SMASeries(macd_start,prev_calculated,rates_total,Signal_SMA,MACDBuffer[bar],bar,false); } //---- Main loop of the MACD indicator coloring for(bar=first2; bar lt rates_total; bar++) { ColorMACDBuffer[bar]=0; if(MACDBuffer[bar] gt 0) { if(MACDBuffer[bar] gt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=1; if(MACDBuffer[bar] lt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=2; } if(MACDBuffer[bar] lt 0) { if(MACDBuffer[bar] lt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=3; if(MACDBuffer[bar] gt MACDBuffer[bar-1]) ColorMACDBuffer[bar]=4; } } //---- Main loop of the signal line coloring for(bar=first3; bar lt rates_total; bar++) { ColorSignBuffer[bar]=0; if(MACDBuffer[bar] gt SignBuffer[bar-1]) ColorSignBuffer[bar]=1; if(MACDBuffer[bar] lt SignBuffer[bar-1]) ColorSignBuffer[bar]=2; } //---- return(rates_total); } //+------------------------------------------------------------------+