Hi/Lo for the previous calander year

Post Reply
BobbyT
Trader
Posts: 232
Joined: Thu Aug 21, 2014 1:34 am
Location: Seattle

Hi/Lo for the previous calander year

Post by BobbyT »

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:
You do not have the required permissions to view the files attached to this post.
Procrastination provides exponentially negative returns - BobbyT
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Hi/Lo for the previous calander year

Post by milanese »

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
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
BobbyT
Trader
Posts: 232
Joined: Thu Aug 21, 2014 1:34 am
Location: Seattle

Hi/Lo for the previous calander year

Post by BobbyT »

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
You do not have the required permissions to view the files attached to this post.
Procrastination provides exponentially negative returns - BobbyT
BobbyT
Trader
Posts: 232
Joined: Thu Aug 21, 2014 1:34 am
Location: Seattle

Hi/Lo for the previous calander year

Post by BobbyT »

Fixed (a while ago but was forgetful enough to post it up)
:oops:
You do not have the required permissions to view the files attached to this post.
Procrastination provides exponentially negative returns - BobbyT
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Hi/Lo for the previous calander year

Post by milanese »

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
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
BobbyT
Trader
Posts: 232
Joined: Thu Aug 21, 2014 1:34 am
Location: Seattle

Hi/Lo for the previous calander year

Post by BobbyT »

No worries.
Thanks for the help :hi:

Cheers,
BobbyT
Procrastination provides exponentially negative returns - BobbyT
Post Reply

Return to “Indicators”