//+------------------------------------------------------------------+ //| EquityOnChart.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| http://www.metaquotes.ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.ru/" //#property indicator_separate_window #property indicator_chart_window #property indicator_buffers 5 #property indicator_color5 Red #property indicator_color4 DarkOrange #property indicator_color3 Blue #property indicator_color2 Black #property indicator_color1 ForestGreen #property indicator_level1 13000 #property indicator_level2 12000 #property indicator_level3 11000 #property indicator_level4 10000 #property indicator_level5 9000 #property indicator_level6 8000 #property indicator_level7 7000 #property indicator_level8 6000 #property indicator_levelcolor Red //---- input parameters extern string fileName="equity.csv"; extern double MaxEquity=13000; extern double MinEquity=6000; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; bool Calculated=false; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,0,3); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE,0,3); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE,0,3); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(3,DRAW_LINE,0,3); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(4,DRAW_LINE,0,5); SetIndexBuffer(4,ExtMapBuffer5); IndicatorShortName(""); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Проверить Максимальную и минимальную цены на графике | //+------------------------------------------------------------------+ void CheckLevels(double & MaxPrice, double & MinPrice) { //---- int period=WindowBarsPerChart(); MaxPrice=High[iHighest(Symbol(),0,MODE_HIGH,period,0)]; MinPrice=Low[iLowest(Symbol(),0,MODE_LOW,period,0)]; Comment(""); //Comment("MaxPrice=",MaxPrice," MinPrice=",MinPrice); //---- return; } //+------------------------------------------------------------------+ //| запись содержимого файла в массив строк array[] | //| в случае неудачи вернем false | //+------------------------------------------------------------------+ bool ReadFileToArray(string &array[],string FileName,string WorkFolderName,int devider='\x90') { bool res=false; int FileHandle; string tempArray[64000],currString; int stringCounter; string FullFileName; if (StringLen(WorkFolderName)>0) FullFileName=StringConcatenate(WorkFolderName,"\\",FileName); else FullFileName=FileName; //---- //Print("Попытка прочитать файл ",FileName); FileHandle=FileOpen(FullFileName,FILE_READ|FILE_CSV,devider); if (FileHandle!=-1) { while(!FileIsEnding(FileHandle)) { currString=FileReadString(FileHandle); tempArray[stringCounter]=currString; //Print(stringCounter,": ",currString); stringCounter++; } stringCounter--; if (stringCounter>0) { ArrayResize(array,stringCounter); for (int i=0;i