stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Weekly Open indicators didn't look right --> fixed
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=589
Page 1 of 1
Author:  idempotent [ Fri May 25, 2012 4:14 pm ]
Post subject:  Weekly Open indicators didn't look right --> fixed

Hi everyone, I'm new here, but am very glad to be here.

I applied the 10.2 indicators, via the template, to a chart. I noticed, though, that other than the latest week, the histograms didn't reset. See the top histogram in the attachment.

Underneath that is the working one, after I tinkered with the code.

Has anyone else encountered this problem?

I'm not sure if I'm barking up the wrong tree or not.

I think the issue might be to do with the server time on the broker. I notice the code waits for a "day of week" equal to 0. My demo broker (FxPro) doesn't every have one - the day of the week ranges from 1 to 5. So as the code works backwards in time, the "wo" (weekly open" variable never gets changed from the first one it processes, which is the most recent one.

The fix was, rather than look for a day-of-week of 0, instead to find when we were at the bar where the day of the week of the *next* bar back in time was higher than the current day of week. That can only happen on the first bar of the week, which is where we want to calculate the new weekly open. Code looks like this:

Code: Select all

if(TimeDayOfWeek(iTime(NULL,0,i)) < TimeDayOfWeek(iTime(NULL,0,i+1))) j++;
The other things that set and use Trigger can be deleted.

Is this the right change to make? Should it then be pushed into the proper release? Without this or something like it, it appears the indicators don't work with some brokers.

Apologies for making this a bit Code-y, but I wanted 10.2 people to see it more than I wanted coders to see it.
Author:  garyfritz [ Fri May 25, 2012 4:32 pm ]
Post subject:  Re: Weekly Open indicators didn't look right --> fixed

idempotent wrote:I'm not sure if I'm barking up the wrong tree or not.
No, you're barking up precisely the right tree. :lol:
http://www.stevehopwoodforex.com/phpBB3 ... 486#p13486
Code looks like this:

Code: Select all

if(TimeDayOfWeek(iTime(NULL,0,i)) < TimeDayOfWeek(iTime(NULL,0,i+1))) j++;
Close. You increment the week (j) when the current date is less than the previous date. But remember the i loop is counting backwards. (It confuses the hell out of ME all the time!) The result is that your week histogram resets on the SECOND bar of the week instead of the first.

My solution in the post I linked above was nearly identical to yours, but looking at bars i and i-1 instead of i and i+1.

This fix hasn't gotten into the "official" release yet but I suspect it will soon.
Author:  idempotent [ Fri May 25, 2012 4:54 pm ]
Post subject:  Re: Weekly Open indicators didn't look right --> fixed

garyfritz wrote:My solution in the post I linked above was nearly identical to yours, but looking at bars i and i-1 instead of i and i+1.
Gary, thanks. I suffer often from off-by-one-itis.

Tony
Author:  Allonso [ Fri Aug 24, 2012 12:55 pm ]
Post subject:  Re: Weekly Open indicators didn't look right --> fixed

Hi,

I have recently loaded the Weekly indicator, but the pivot, support and resistance lines all appear as thick white lies. So I reset the line thickness to 1, great so far. Then if I change time frames it all reverts back to the thick lines.
Can any one advise on why this happens.

Thanks Allonso
Author:  NeoTrader [ Fri Aug 24, 2012 2:51 pm ]
Post subject:  Re: Weekly Open indicators didn't look right --> fixed

Hi Allonso,
Allonso wrote:I have recently loaded the Weekly indicator, but the pivot, support and resistance lines all appear as thick white lies. So I reset the line thickness to 1, great so far. Then if I change time frames it all reverts back to the thick lines.
Can any one advise on why this happens.
This happens when the width is hardcoded in the indicator...every time you change TF or Symbol the indicator is reinitialized and the original values are back...the only way you can solve this is to edit it in the code or create a template and use it every time you change TF or Symbol...

Alternatively you can also use Baludas DWMPivots (use search)...

happy weekend,

NeoTrader

-
Author:  Jack1 [ Sat Aug 25, 2012 1:51 pm ]
Post subject:  Re: Weekly Open indicators didn't look right --> fixed

I modified this indicator. Don't know if it is correct.

This may be used as a price sentiment bias indicator based on an ma line: 2 week ma or 10 day ma or 240 hour ma.

10.2 is based on this ma line direction bias, and weekly pivot point level, and shift forward ma(5) lines as a trigger line for entry, and a slop indicator, Is my reading correct ?
All times are UTC Page 1 of 1