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

Hi/Lo for the previous calander year
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4251
Page 1 of 1
Author:  BobbyT [ Thu May 14, 2015 1:55 pm ]
Post subject:  Hi/Lo for the previous calander year

Hello all,
I'm back with a menial problem for some kind soul to assist with.
I'm writing my own high/low indicator for the previous day/week/month/year high and low. It all works with the exception of the yearly high low calculations.
It's not even that they aren't calculating properly it's just that when the MN1 chart is called up the yearly hi/lo channel goes a bit screwy (see the pics below) which leads me to suspect it has to do with me using PERIOD_MN1 for the calculations instead of using daily bars or bars on the chart specifically. But I'm not too sure how else to code it :oops:
I wouldn't even really be looking at the monthly chart normally/regularly anyway but it's a glitch nonetheless, one that is bugging me anyways.
I've attached the indi. It's trademark 'no frills' BobbyT style coding so should be pretty easy to follow even for the most noobish coder (including myself) :smile:

Cheers,
BobbyT :hi:
Author:  milanese [ Thu May 14, 2015 2:19 pm ]
Post subject:  Hi/Lo for the previous calander year

I used in past this formulas:

Code: Select all

double lastYearHigh = iHigh(NULL, PERIOD_MN1, iHighest(NULL, PERIOD_MN1, MODE_HIGH, 12, Month()));
   double lastYearLow = iLow(NULL, PERIOD_MN1, iLowest(NULL, PERIOD_MN1, MODE_LOW, 12, Month()));
 
   double thisYearHigh = iHigh(NULL, PERIOD_MN1, iHighest(NULL, PERIOD_MN1, MODE_HIGH, Month(), 0));
   double thisYearLow = iLow(NULL, PERIOD_MN1, iLowest(NULL, PERIOD_MN1, MODE_LOW, Month(), 0));

Cheers :)

Tommaso
Author:  BobbyT [ Thu May 14, 2015 3:10 pm ]
Post subject:  Hi/Lo for the previous calander year

HI Tommaso,

Thanks for the reply. I had tried this previously and it gives the attached output.
Maybe there's something else wrong with the code that breaks your solution. In fact, I would put money on it. If there's is anyone around here that knows indis it's you :good:

Cheers,
BobbyT
Author:  BobbyT [ Wed Jun 17, 2015 8:46 am ]
Post subject:  Hi/Lo for the previous calander year

Fixed (a while ago but was forgetful enough to post it up)
:oops:
Author:  milanese [ Wed Jun 17, 2015 9:21 am ]
Post subject:  Hi/Lo for the previous calander year

BobbyT ยป Wed Jun 17, 2015 8:46 am wrote:Fixed (a while ago but was forgetful enough to post it up)
:oops:
thank you for posting it :clap:

Cheers :)

Tommaso
Author:  BobbyT [ Wed Jun 17, 2015 9:44 am ]
Post subject:  Hi/Lo for the previous calander year

No worries.
Thanks for the help :hi:

Cheers,
BobbyT
All times are UTC Page 1 of 1