Hello again,
I need the opening price at the beginning of each day, week and month.
For the day and month I use:
if (day() != day(-1)) mvVar = open();
if (month() != month(-1)) myVar = open();
As there is no week() function that I know of I'm struggling to identify the beginning of the week i.e. Monday.
So far, I've got this:
var today = new Date();
if (today.getDay() == 1) myVar = open();
but it isn't working. When I use bar replay today.getDay() is always 5 because today (the day I'm actually doing this rather than the day of the bar I'm looking at) is Friday.
I hope this makes some sense to someone who can help me.
I just need the opening price on a Monday morning.
Thank you in advance.
I need the opening price at the beginning of each day, week and month.
For the day and month I use:
if (day() != day(-1)) mvVar = open();
if (month() != month(-1)) myVar = open();
As there is no week() function that I know of I'm struggling to identify the beginning of the week i.e. Monday.
So far, I've got this:
var today = new Date();
if (today.getDay() == 1) myVar = open();
but it isn't working. When I use bar replay today.getDay() is always 5 because today (the day I'm actually doing this rather than the day of the bar I'm looking at) is Friday.
I hope this makes some sense to someone who can help me.
I just need the opening price on a Monday morning.
Thank you in advance.
Comment