Weekly Open indicators didn't look right --> fixed

Post Reply
idempotent
Trader
Posts: 83
Joined: Thu May 24, 2012 1:36 pm

Weekly Open indicators didn't look right --> fixed

Post by idempotent »

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.
You do not have the required permissions to view the files attached to this post.
garyfritz

Re: Weekly Open indicators didn't look right --> fixed

Post by garyfritz »

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.
idempotent
Trader
Posts: 83
Joined: Thu May 24, 2012 1:36 pm

Re: Weekly Open indicators didn't look right --> fixed

Post by idempotent »

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
Allonso
Trader
Posts: 30
Joined: Mon Aug 20, 2012 11:53 am

Re: Weekly Open indicators didn't look right --> fixed

Post by Allonso »

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
User avatar
NeoTrader
Trader
Posts: 436
Joined: Wed Apr 04, 2012 2:52 pm
Location: small Village at Lake Chiemsee, Bavaria, Germany

Re: Weekly Open indicators didn't look right --> fixed

Post by NeoTrader »

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

-
Jack1

Re: Weekly Open indicators didn't look right --> fixed

Post by Jack1 »

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 ?
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Nanningbob 10.x”