Calculate week/day highest/lowest on minute bar chart  [SOLVED]

Questions about MultiCharts and user contributed studies.
Lily
Posts: 2
Joined: 13 Sep 2013
Has thanked: 1 time

Calculate week/day highest/lowest on minute bar chart

Postby Lily » 13 Sep 2013

Hi,
I have a question that I hope I can get some help with.
I've used some other automated trading platforms before, and if I used minute bar chart but my trading signal depended on day/week highest/lowest line, I should use a built-in function to convert the time frame of the bar. The aim of this is to trade intraday.
I don't know whether I need to write some functions to reach it with multicharts. Does multicharts has a more convenient way to do that?

Thank you

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Calculate week/day highest/lowest on minute bar chart

Postby JoshM » 13 Sep 2013

I've used some other automated trading platforms before, and if I used minute bar chart but my trading signal depended on day/week highest/lowest line, I should use a built-in function to convert the time frame of the bar. The aim of this is to trade intraday.
I don't know whether I need to write some functions to reach it with multicharts. Does multicharts has a more convenient way to do that?
I think you're overthinking it. Sure, you can write it in a function, but multiple functions or converting bars are not needed if you just want to track the daily (or weekly) high or low.

In pseudo-code, you could try something like:

Code: Select all

Variables:
weeklyHigh(0),
weeklyLow(99999);

// Reset variables on monday
if (DayOfWeek(Date) = 1 {Monday} ) begin
weeklyHigh = 0;
weeklyLow = 999999;
end;

weeklyHigh = MaxList(weeklyHigh, High);
weeklyLow = MinList(weeklyLow, Low);

Lily
Posts: 2
Joined: 13 Sep 2013
Has thanked: 1 time

Re: Calculate week/day highest/lowest on minute bar chart  [SOLVED]

Postby Lily » 13 Sep 2013

Hello JoshM, your reply inspired me greatly, thank you. Your code indicates weekly high and low clearly.
Further, if I want to retreat a few weeks/days further in every different day, for example, if today is Wednesday, then I want to calculate the high/low from last Wednesday or the Wednesday a few weeks ago. Still using minute bar chart.
Will the code become more complicated?

Thank you!


Return to “MultiCharts”