//+----------------------------------------------------------------------+ //| FisherCGOscillator_Signal.mq5 | //| Copyright © 2014, Nikolay Kositsin | //| Khabarovsk, farria@mail.redcom.ru | //+----------------------------------------------------------------------+ //| For the indicator functioning, place the FisherCGOscillator.mq5 file | //| to the terminal_data_folder\MQL5\Indicators and compile it | //+----------------------------------------------------------------------+ #property copyright "Copyright © 2014, Nikolay Kositsin" #property link "farria@mail.redcom.ru" #property description "" //--- indicator version #property version "1.60" //--- drawing the indicator in a separate window #property indicator_separate_window //--- fixed height of the indicator subwindow in pixels #property indicator_height 20 //--- lower and upper scale limit of a separate indicator window #property indicator_maximum +1.9 #property indicator_minimum +0.3 //+----------------------------------------------+ //| declaring constants | //+----------------------------------------------+ #define RESET 0 // A constant for returning the indicator recalculation command to the terminal #define INDTOTAL 1 // A constant for the number of displayed indicator #define INDICATOR_NAME "FisherCGOscillator" // A constant for the indicator name //+----------------------------------------------+ //--- number of indicator buffers #property indicator_buffers 4 // INDTOTAL*4 //--- total plots used #property indicator_plots 2 // INDTOTAL*2 //+----------------------------------------------+ //| Indicator 1 drawing parameters | //+----------------------------------------------+ //--- drawing indicator 1 as a line #property indicator_type1 DRAW_COLOR_LINE //--- the following colors are used for the indicator line #property indicator_color1 clrDarkOrange,clrGray,clrDodgerBlue //--- the indicator line is dashed #property indicator_style1 STYLE_SOLID //--- indicator line width is 3 #property indicator_width1 3 //--- displaying the indicator label #property indicator_label1 "Signal line" //+----------------------------------------------+ //| Indicator 2 drawing parameters | //+----------------------------------------------+ //--- drawing the indicator as four-color labels #property indicator_type2 DRAW_COLOR_ARROW //--- colors of the five-color histogram are as follows #property indicator_color2 clrDarkOrange,clrGray,clrDodgerBlue //--- Indicator line is a solid one #property indicator_style2 STYLE_SOLID //--- indicator line width is 5 #property indicator_width2 5 //--- displaying the indicator label #property indicator_label2 "Signal Arrow" //+----------------------------------------------+ //| Indicator input parameters | //+----------------------------------------------+ input ENUM_TIMEFRAMES TimeFrame=PERIOD_H4; // Chart period input uint Length=10; // Indicator period //+----------------------------------------------+ //--- declaration of integer variables for the start of data calculation int min_rates_total; //+------------------------------------------------------------------+ //| Getting a timeframe as a line | //+------------------------------------------------------------------+ string GetStringTimeframe(ENUM_TIMEFRAMES timeframe) {return(StringSubstr(EnumToString(timeframe),7,-1));} //+------------------------------------------------------------------+ //| Indicator buffer class | //+------------------------------------------------------------------+ class CIndBuffers { //--- public: double m_LineBuffer[]; double m_ColorLineBuffer[]; double m_ArrowBuffer[]; double m_ColorArrowBuffer[]; int m_Handle; ENUM_TIMEFRAMES m_TimeFrame; //--- }; //--- declaration of dynamic arrays that will be used as indicator buffers CIndBuffers Ind[INDTOTAL]; //+------------------------------------------------------------------+ //| FisherCGOscillator indicator initialization function | //+------------------------------------------------------------------+ bool IndInit(uint Number) { //--- checking correctness of the chart periods if(Ind[Number].m_TimeFrameRates_Total || Prev_Calculated<=0)// checking for the first start of the indicator calculation { limit_=Limit; LastCountBar[Number]=limit_; } else limit_=int(MathMin(LastCountBar[Number]+Limit,Rates_Total-2)); // starting index for calculating new bars //--- main indicator calculation loop for(int bar=int(limit_); bar>=0 && !IsStopped(); bar--) { //--- reset the contents of the indicator buffers for calculation Ind[Number].m_LineBuffer[bar]=Number+1.0; Ind[Number].m_ArrowBuffer[bar]=EMPTY_VALUE; Ind[Number].m_ColorLineBuffer[bar]=EMPTY_VALUE; //--- Time0=Time[bar]; //--- copy newly appeared data in the array if(CopyTime(Symbol(),Ind[Number].m_TimeFrame,Time0,1,Time_)<=0) return(RESET); //--- if(Time0>=Time_[0] && Time[bar+1]Sign[0]) Ind[Number].m_ColorLineBuffer[bar]=2; if(Main[0]rates_total || prev_calculated<=0)// Checking for the first start of the indicator calculation limit=rates_total-min_rates_total-1; // Starting index for calculation of all bars else limit=rates_total-prev_calculated; // Starting index for the calculation of new bars //--- apply timeseries indexing to array elements ArraySetAsSeries(time,true); for(int count=0; count