//+------------------------------------------------------------------+ //| Price Channel Central.mq4 | //| Yuriy Tokman (YTG) | //| http://ytg.com.ua/ | //+------------------------------------------------------------------+ #property copyright "Yuriy Tokman (YTG)" #property link "http://ytg.com.ua/" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 Green #property indicator_color3 Blue #property indicator_width1 2 #property indicator_width2 2 //---- extern int Bars_Count=32; //---- buffers double B0[]; double B1[]; double B2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping int shift_begin=Bars_Count; IndicatorShortName("Price Channel Central ("+DoubleToStr(Bars_Count,0)+")"); SetIndexBuffer(0,B0); SetIndexBuffer(1,B1); SetIndexBuffer(2,B2); SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE); SetIndexDrawBegin(0,shift_begin); SetIndexDrawBegin(1,shift_begin); SetIndexDrawBegin(2,shift_begin); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- ArrowRightPriceDelete(0,"RightPrice1"); ArrowRightPriceDelete(0,"RightPrice2"); ArrowRightPriceDelete(0,"RightPrice3"); ArrowRightPriceDelete(0,"Label"); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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 limit=rates_total-prev_calculated; if(prev_calculated==0)limit--; else limit++; double hi=0,lo=0,ce=0; for(int i=0; iB2[0]){colir=clrGreen; sig = "BUY";} if(Ask