This is a discussion on Requests and Raw Ideas within the General Discussion forums, part of the Trading Forum category; Originally Posted by logicgate @igorad Do you think you can handle the request above? ^^^^^^^^ I've already re-sent this request ...
Premium Trading Forum: subscription, public discussion and latest news
Trading Forum wiki || MQL5 channel for the forum
Trading blogs || My blog
Thanks buddy,
Another thing that I Was thinking is that the indicator can be converted to MT5. Given that MT5 has tick history feature, if you run the cumulativedelta indi there it will get a 100% score on the backtest, right? Real ticks. So you set the indi to record the ticks, run the tester in MT5, when it finishes you quickly grab the file generated by it and paste in MT4 and launch the indi there, you can do this in like 1min. Then the indi will load there with historical data made with real ticks.
Hi there buddy. I thought of another idea too that can use the code of the cumulativedelta indi attached in the request above. In this version, you can remove from the code the plotting of bars in the subwindow. We are only interested in numerical values. The indicator would have an input "Average" where we would set the number of bars to include in the delta calculation. For example, if we put 7 in there, the sum of delta of last 7 bars (including the current one) would be displayed in a corner of screen. There would be all timeframes there M1, M5, M15 etc.. and right next to the timeframe the corresponding delta. ( I have attached an image). If the input is set to zero, then the values displayed are for the current bar. You have to change the name of the recorded ticks file so it won´t clash with the regular cumulative delta. Tell it to save like US500_Ticks (the cum. delta saves as Ticks_US500). Best regards.
Indicator from this post #507 ?
I will ask Igorad to improve this indicator (but please note that Igorad may be overloaded by the requests).
Premium Trading Forum: subscription, public discussion and latest news
Trading Forum wiki || MQL5 channel for the forum
Trading blogs || My blog
Dear members who are good at coding Mql4.
I would like to ask for help with indicators looking at the previous day's data.
So I already have yesterday's High Low indicator and it is displayed today.
But I want to add MA indicator with levels which calculates yesterday's high low.
like this the picture.
Thank you very much for your help.
This code indicator
Code://+------------------------------------------------------------------+ //| MTF_HI_LOW_v1.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property link " modified by cja " #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 White #property indicator_color2 White #property indicator_color3 White extern int BarsCount = 100; extern int MAperiod = 100; extern int CountDays=100; extern bool Show_LABELS = true; extern bool Show_MA = true; extern bool Show_PreviousDaily = true; extern bool Xtend_Prev_DailyLine = false; extern color line_color_PreviousDaily = Aqua; extern int PreviousLine_Style = 2; extern int Shift_Prev_LABEL = 10; extern bool Show_CurrRectangles_Display = false; extern bool Show_Rectangles = true; extern bool Rectangle_Curr_DayPeriod_only = false; double max =0; double min =0; double Inc0 = 0.0000; double Inc1 = 0.0000; double Inc3 = 0.0000; #define Curr_DG "Curr_DG" #define Curr_WG "Curr_WG" #define Curr_MG "Curr_MG" datetime time1; datetime time2; datetime time3; datetime time4; datetime time5; datetime time6; //****************************** //currTimes datetime time7; datetime time8; datetime time9; datetime time10; datetime time11; datetime time12; //******************************** //Pivot double upper[], middle[], lower[]; double mmiddle,bottom,top; double DHi,DLo; double DHigh,DLow; double highD,lowD,closeD; double PD,PW,PM; int shift, num; void ObjDel() { for (;num<=CountDays;num++) { ObjectDelete("Previous_DailyHi["+num+"]"); ObjectDelete("Previous_DailyLo["+num+"]"); ObjectDelete("CurrentDailyHi["+num+"]"); ObjectDelete("CurrentDailyLo["+num+"]"); } } void PlotLineD(string dname,double value,double line_color_Daily,double style) { ObjectCreate(dname,OBJ_TREND,0,time1,value,time2,value); ObjectSet(dname, OBJPROP_WIDTH, 1); ObjectSet(dname, OBJPROP_STYLE, PreviousLine_Style); ObjectSet(dname, OBJPROP_RAY, Xtend_Prev_DailyLine); ObjectSet(dname, OBJPROP_BACK, true); ObjectSet(dname, OBJPROP_COLOR, line_color_Daily); } int init() { IndicatorShortName("MTF_HI_LOW"); SetIndexStyle(0,DRAW_LINE); SetIndexShift(0,0); SetIndexDrawBegin(0,0); SetIndexBuffer(0,upper); SetIndexStyle(1,DRAW_LINE); SetIndexShift(1,0); SetIndexDrawBegin(1,0); SetIndexBuffer(1,middle); SetIndexStyle(2,DRAW_LINE); SetIndexShift(2,0); SetIndexDrawBegin(2,0); SetIndexBuffer(2,lower); //---- indicators return(0); } int deinit() { max =0; min =0; ObjectsDeleteAll(0,OBJ_RECTANGLE); ObjectsDeleteAll(0,OBJ_TRENDBYANGLE); ObjectsDeleteAll(0,OBJ_TEXT); ObjDel(); Comment(""); return(0); } int start() //******************************************************************************************* { CreateDHI(); } void Create_DailyLineHI(string dLine, double start, double end,double w, double s,color clr) { ObjectCreate(dLine, OBJ_RECTANGLE, 0, iTime(NULL,1440,0), start, Time[0], end); ObjectSet(dLine, OBJPROP_COLOR, clr); ObjectSet(dLine,OBJPROP_RAY,false); ObjectSet(dLine,OBJPROP_BACK,Show_Rectangles); ObjectSet(dLine,OBJPROP_WIDTH,w); ObjectSet(dLine,OBJPROP_STYLE,s); } void DeleteCreate_DailyLineHI() { ObjectDelete( Curr_DG);ObjectDelete( Curr_WG);ObjectDelete( Curr_MG); } void CreateDHI() { DeleteCreate_DailyLineHI(); ObjectsDeleteAll(0,OBJ_RECTANGLE); CreateWHI(); } void Create_DailyLineWHI(string WLine, double start, double end,double w, double s,color clr) { ObjectCreate(WLine, OBJ_RECTANGLE, 0, iTime(NULL,10080,0), start, Time[0], end); ObjectSet(WLine, OBJPROP_COLOR, clr); ObjectSet(WLine,OBJPROP_RAY,false); ObjectSet(WLine,OBJPROP_BACK,Show_Rectangles); ObjectSet(WLine,OBJPROP_WIDTH,w); ObjectSet(WLine,OBJPROP_STYLE,s); } void DeleteCreate_DailyLineWHI() { ObjectDelete( Curr_WG); } void CreateWHI() { DeleteCreate_DailyLineWHI(); ObjectsDeleteAll(0,OBJ_RECTANGLE); CreateMHI(); } void Create_DailyLineMHI(string MLine, double start, double end,double w, double s,color clr) { ObjectCreate(MLine, OBJ_RECTANGLE, 0, iTime(NULL,43200,0), start, Time[0], end); ObjectSet(MLine, OBJPROP_COLOR, clr); ObjectSet(MLine,OBJPROP_RAY,false); ObjectSet(MLine,OBJPROP_BACK,Show_Rectangles); ObjectSet(MLine,OBJPROP_WIDTH,w); ObjectSet(MLine,OBJPROP_STYLE,s); } void DeleteCreate_DailyLineMHI() { ObjectDelete( Curr_MG); } void CreateMHI() { DeleteCreate_DailyLineMHI(); ObjectsDeleteAll(0,OBJ_RECTANGLE); double Dailyhigh = iHigh(NULL,1440,0); double Dailylow = iLow(NULL,1440,0); if ( Rectangle_Curr_DayPeriod_only == false ) { if (Show_CurrRectangles_Display == true ) { }} if ( Rectangle_Curr_DayPeriod_only == true ) { if (Show_CurrRectangles_Display == true ) { }} //******************************************************************************* int i; double avg; ObjDel(); num=0; max =0; min =0; if (iBars(NULL,0) < BarsCount) BarsCount = iBars(NULL,0) -MAperiod-1 ; for (shift=CountDays-1;shift>=0;shift--) { time1=iTime(NULL,PERIOD_D1,shift); i=shift-1; if (i<0) time2=Time[0]; else time2=iTime(NULL,PERIOD_D1,i)-Period()*60; if (i<0) time4=Time[0]; else if (i<0) time8=iTime(NULL,PERIOD_D1,0)-Period()*60; //********************************************************* //for(int x=BarsCount; x>=0; x--) { middle[i] = iMA(NULL, 0,MAperiod, 0, MODE_EMA, PRICE_CLOSE, i); avg = findAvg(MAperiod, i); upper[i] = middle[i] + avg; lower[i] = middle[i] - avg; //} /* //for(int z=0; z<i; z++) { mmiddle = iMA(NULL, 0, MAperiod, 0, MODE_EMA, PRICE_CLOSE,shift+1); top = DHi - mmiddle; if (top > max) max = top; bottom = DLo - mmiddle; if (bottom < min) min = bottom; // avg = findAvg(period, x); //upper[x] = middle[x] + 540; //lower[x] = middle[x] - avg; //}//return; if (MathAbs(max) > MathAbs(min)) Inc3 = max; else Inc3 = min; Inc1 = Inc3*1; Inc0 = Inc3*1; //for (x =BarsCount; x>=0; x--) // { upper[i] = iMA(NULL,0,MAperiod,0,MODE_EMA,PRICE_CLOSE,num) + Inc0; lower[i] = iMA(NULL,0,MAperiod,0,MODE_EMA,PRICE_CLOSE,num) - Inc1;*/ highD = iHigh(NULL,PERIOD_D1,shift+1); lowD = iLow(NULL,PERIOD_D1,shift+1); closeD = iClose(NULL,PERIOD_D1,shift+1); PD = (highD+lowD+closeD)/3.0; DHi = iHigh(NULL,PERIOD_D1,shift+1); DLo = iLow(NULL,PERIOD_D1,shift+1); //*************************** //CurrDaily levels DHigh = iHigh(NULL,PERIOD_D1,0); DLow = iLow(NULL,PERIOD_D1,0); time2=time1+PERIOD_D1*60; time4=time3+PERIOD_W1*60; time6=time5+PERIOD_MN1*60; //****************************************** // CurrDaily levels time8=time7+PERIOD_D1*60; time10=time9+PERIOD_W1*60; time12=time11+PERIOD_MN1*60; num=shift; if (Show_PreviousDaily == true) { PlotLineD("Previous_DailyHi["+num+"]",DHi,line_color_PreviousDaily,0); PlotLineD("Previous_DailyLo["+num+"]",DLo,line_color_PreviousDaily,0); } //if (Show_MA == true) //{ // middle = iMA(NULL, 0, period, 0, MODE_EMA, PRICE_CLOSE, 0); //avg = findAvg(period, x); //upper = middle[x] + avg; //lower = middle[x] - avg; //} } return(0); if (Show_LABELS == true) { //Previous Levels if(ObjectFind("HILOP") != 0){ ObjectCreate("HILOP", OBJ_TEXT, 0, Time[Shift_Prev_LABEL+10], DHi); ObjectSetText("HILOP", "Prev / Daily High "+DoubleToStr(DHi,Digits)+" ", 8, "Arial", line_color_PreviousDaily); }else{ ObjectMove("HILOP", 0, Time[Shift_Prev_LABEL+10], DHi);} if(ObjectFind("HILO1P") != 0){ ObjectCreate("HILO1P", OBJ_TEXT, 0, Time[Shift_Prev_LABEL+10], DLo); ObjectSetText("HILO1P", "Prev / Daily Low "+DoubleToStr(DLo,Digits)+" ", 8, "Arial", line_color_PreviousDaily); }else{ ObjectMove("HILO1P", 0, Time[Shift_Prev_LABEL+10], DLo);} } return; } double findAvg(int MAperiod, int shift) { double sum=0; for (int x=shift;x<(shift+MAperiod);x++) { sum += High[x]-Low[x]; } sum = sum/MAperiod; return (sum); } //+------------------------------------------------------------------+
Premium Trading Forum: subscription, public discussion and latest news
Trading Forum wiki || MQL5 channel for the forum
Trading blogs || My blog
Ocean of thanks !!! Have a nice day!
Bookmarks