//****** project (module Trail): tf-test-g1_module_Trail_ind.mq5 //+------------------------------------------------------------------+ //| The program code is generated Modular project generator | //| Copyright 2010-2017, Sergey Pavlov (DC2008) | //| http://www.mql5.com/ru/users/dc2008 | //+------------------------------------------------------------------+ #property copyright "Copyright 2010-2017, Sergey Pavlov (DC2008)" #property link "http://www.mql5.com/ru/users/dc2008" #property link "1.00" #property link "Example of a multimodule expert: project tf-test-g1 module Trail" //--- Display indicator in the chart window #property indicator_chart_window //--- Number of buffers to calculate the indicator #property indicator_buffers 1 //--- Number of graphic series in the indicator #property indicator_plots 1 //--- double Buffer1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- ArraySetAsSeries(Buffer1,true); SetIndexBuffer(0,Buffer1,INDICATOR_DATA); 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[]) { double TR=30; // Trail in points //--- calculation of Trail Buffer1[0]=TR; return(rates_total); }; //+------------------------------------------------------------------+