//+------------------------------------------------------------------+ //| Figure.mq5 | //| Copyright © 2019, Vladimir Karputov | //| http://wmua.ru/slesar/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2019, Vladimir Karputov" #property link "http://wmua.ru/slesar/" #property version "1.000" #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 3 //--- plot FATL #property indicator_label1 "FATL" #property indicator_type1 DRAW_LINE #property indicator_color1 clrViolet #property indicator_style1 STYLE_SOLID #property indicator_width1 2 //--- plot RSTL #property indicator_label2 "RSTL" #property indicator_type2 DRAW_LINE #property indicator_color2 clrWheat #property indicator_style2 STYLE_SOLID #property indicator_width2 2 //--- plot RFTL #property indicator_label3 "RFTL" #property indicator_type3 DRAW_LINE #property indicator_color3 clrIndianRed #property indicator_style3 STYLE_SOLID #property indicator_width3 2 //--- indicator buffers double FATLBuffer[]; double RSTLBuffer[]; double RFTLBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,FATLBuffer,INDICATOR_DATA); SetIndexBuffer(1,RSTLBuffer,INDICATOR_DATA); SetIndexBuffer(2,RFTLBuffer,INDICATOR_DATA); //--- ArraySetAsSeries(FATLBuffer,true); ArraySetAsSeries(RSTLBuffer,true); ArraySetAsSeries(RFTLBuffer,true); //--- PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0.0); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| 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[]) { if(rates_total<300) return(0); ArraySetAsSeries(close,true); //--- int limit=rates_total-prev_calculated+1; if(prev_calculated==0) { ArrayInitialize(FATLBuffer,0.0); ArrayInitialize(RSTLBuffer,0.0); ArrayInitialize(RFTLBuffer,0.0); limit=rates_total-1-98; } for(int i=0;i