hey guys,
thanks for the link to the other indicator. but i want to know how this problem can be solved.
i show you my idea and maybe someone would explain why that idea doesn't work.
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 (dayofweek==1)
{
high = iHigh(NULL,PERIOD_D1,shift+2);
low = iLow(NULL,PERIOD_D1,shift+2);
open = iOpen(NULL,PERIOD_D1,shift+2);
close = iClose(NULL,PERIOD_D1,shift+2);
}
else
{
high = iHigh(NULL,PERIOD_D1,shift+1);
low = iLow(NULL,PERIOD_D1,shift+1);
open = iOpen(NULL,PERIOD_D1,shift+1);
close = iClose(NULL,PERIOD_D1,shift+1);
}
i thought this way: check if it a monday. if yes, go back 2 days and take the data of friday (shift+2 instead of shift+1).
i don't care if there are some lines on sunday. the important thing is that the pivots are correct on monday and so i just want the fridays' data to be taken for calculation.
but what is wrong with that idea??
- Use SRC
- if (dayofweek==1) what is dayofweek? an unchanging variable?
- if (dayofweek==1) what is dayofweek? did you mean DayOfWeek() that return what day TODAY is, not what day shift is.
- if (TimeDayOfWeek(time1) would work as you coded it. It would draw Friday's lines TWICE (on Sunday and Monday.) This solution will only work on brokers that have a Sunday. Brokers running with UTC+2 or earlier don't have a Sunday bar.
- For all brokers
int iYesterday=shift+1; datetime yesterday = iTime(NULL,PERIOD_D1,iYesterday); if (TimeDayOfWeek(yesterday) = 0) iYesterday++; // Data from Friday not Sunday high = iHigh(NULL,PERIOD_D1,iYesterday); low = iLow(NULL,PERIOD_D1,iYesterday); open = iOpen(NULL,PERIOD_D1,iYesterday); close = iClose(NULL,PERIOD_D1,iYesterday);
1. sorry, i will do next time.
2. -
3. i really thought that DayOfWeek() returns the shift day.
4. -
5. thank you very much for your help!!!!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi to all!
i used the search function to solve this problem on my own and i found something but the problem is, i don't know how and where to implement it.
i would be very happy if someone fixed this pivot-indicator that it ignores sunday data. i tried it with "if (dayofweek==1) shift++;" but obviously the indicator does not use the friday data for pivot calculation. i found some other pivot-indicators with the ignore sunday data option but this one is so great, because it also shows pivots many days back.
thanks for your help!!