//****** project (module MM): tf-test-g1_module_MM_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 MM" //--- 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 //--- input double lot_perc=0.1; // Percentage of Equity value 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 Equity=AccountInfoDouble(ACCOUNT_EQUITY); //--- calculation of the lot of equity Buffer1[0]=NormalizeDouble(Equity*lot_perc/1000.0,2); // Lot size determination function if(Buffer1[0]<0.01) Buffer1[0]=0.01; return(rates_total); }; //+------------------------------------------------------------------+