pivot indicator does not ignore sunday data

 

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!!

Files:
 
mar: 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.
This one also have the "many days back". Here. If you don't like the look then modify the colors and lines. If you don't want to learn coding then Hire someone or keep waiting.
 
mar:
i don't know how and where to implement it.

i would be very happy if someone fixed this
  1. How happy? No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
  2. if (TimeDayOfWeek(time1) == 1)  continue;   // Skip Sunday

 

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??

 

Please use this to post code . . . it makes it easier to read.

 
  1. Use SRC
  2. if (dayofweek==1) what is dayofweek? an unchanging variable?
  3. if (dayofweek==1) what is dayofweek? did you mean DayOfWeek() that return what day TODAY is, not what day shift is.
  4. 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.
  5. 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);
    

 
Seconded! ;)))
 

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!!!!