How to make this pivot indicator to plot only HLINES for the month
jb1981: Attached is the source of this indicator. ... change or replace the ObjectMove instances.. could someone advice on how to do this?
Nothing attached. Stop using objects and use your buffers. Fix the indicator so it works on ANY timeframe| Your code | for(i=limit-1; i>=0; i--) { // 1sts Days of Month if(TimeDay(Time[i])<=3 && TimeDay(Time[i+1])>=26) { last_month_close=Close[i+1]; // Wrong only on a D1 chart this_month_open=Open[i]; // and when i=First of the month P=(last_month_high+last_month_low+last_month_close)/3; R1=(2*P)-last_month_low; S1=(2*P)-last_month_high; R2=P+(last_month_high-last_month_low); S2=P-(last_month_high-last_month_low); ObjectMove("Monthly Pivot",0,Time[i],P); // Stop using objects, use your buffers ObjectMove("Monthly Sup1",0,Time[i],S1); ObjectMove("Monthly Res1",0,Time[i],R1); ObjectMove("Monthly Sup2",0,Time[i],S2); ObjectMove("Monthly Res2",0,Time[i],R2); last_month_low=Low[i]; // False that's the last day of the last_month_high=High[i]; // month if you fix the above problem. } last_month_low=MathMin(last_month_low,Low[i]); last_month_high=MathMax(last_month_high,High[i]); PBuffer[i]=P; |
| Monthly pivot on any time frame | datetime monthStarts = iTime(NULL, PERIOD_MN1,0); last_month_close = iClose(NULL, PERIOD_MN1, 1); this_month_open = iOpen(NULL, PERIOD_MN1, 0); last_month_low = iLow(NULL, PERIOD_MN1, 1); last_month_high = iHigh(NULL, PERIOD_MN1, 1); P= .. : int iMNlimit = iBarShift(NULL,0, monthStarts) + 1; if(limit>iMNlimit) limit=iMNlimit; for(i=limit-1; i>=0; i--) PBuffer[iChart] = P; : } |
Attached is the source of this indicator. Currently it makes use of ObjectMove to continuously plot the pivot levels. I'm trying to modify this indi so that it plots HLINES (Horizontal lines) for the pivot levels for the past month..
I believe I have to change or replace the ObjectMove instances.. could someone advice on how to do this?
Here's how I want the pivot levels to be displayed: https://www.mql5.com/en/charts