How to program the daily ATR on a 5-minute chart?

Questions about MultiCharts and user contributed studies.
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

How to program the daily ATR on a 5-minute chart?

Postby moses » 13 Apr 2016

Hello everyone,

I'd greatly appreciate any help you could give me with this - I need to find the day's ATR (using easylanguage), but I need to do it on the 5-minute chart.

As background (and in case anyone has any other ideas on how to solve it), my problem is that I have a daily FX strategy, but my broker (Interactive Brokers) shuts down for 15 minutes at 5pm Eastern time. This means I need to transform my strategy to work on a 5-minute chart, so it can enter trades at 16:55.
(if you are trading FX, does your broker also shut down at 5pm?)

Thanks a lot

Posts: 455
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: How to program the daily ATR on a 5-minute chart?

Postby SP » 13 Apr 2016

I posted a workaround some years ago


User avatar
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: How to program the daily ATR on a 5-minute chart?

Postby bensat » 13 Apr 2016

Function : TrueHighD

Code: Select all

input: daysBack(numericSimple);

var: HighThatDay(0);
var: CloseBeforeThatDay(0);

CloseBeforeThatDay = CloseD(daysBack+1);
HighThatDay = HighD(daysBack);

if CloseBeforeThatDay > HighThatDay then TrueHighD = CloseBeforeThatDay else
TrueHighD = HighThatDay;
Function: TrueLowD

Code: Select all

input: daysBack(numericSimple);

var: LowThatDay(0);
var: CloseBeforeThatDay(0);

CloseBeforeThatDay = CloseD(daysBack+1);
LowThatDay = LowD(daysBack);

if CloseBeforeThatDay < LowThatDay then TrueLowD = CloseBeforeThatDay else
TrueLowD = LowThatDay;
Function: TrueRangeD

Code: Select all

input: daysBack(numericSimple);

TrueRangeD = TrueHighD(daysBack) - TrueLowD(daysBack);
Function: AverageTrueRangeD

Code: Select all

inputs: Length(numericsimple);

var: dayHi(0);
var: dayLo(0);

if Length = 0 or Length = 1 then AvgTrueRangeD = TrueRangeD(Length) else
if date <> date[1] then AvgTrueRangeD = AvgTrueRangeD[1] - TrueRangeD(Length)/Length + TrueRangeD(0) / Length else
dayHi = HighD(0);
dayLo = LowD(0);

if dayHi = dayHi[1] and dayLo = dayLo[1] then AvgTrueRangeD = AvgTrueRangeD[1] else
AvgTrueRangeD = AvgTrueRangeD[1] - TrueRangeD(0)[1] / Length + TrueRangeD(0) / Length;
Indicator: AverageTrueRange Daily(intraday)

Code: Select all

inputs: ATRDLength(5);

var: it(0);

it = AvgTrueRangeD(ATRDLength);

Plot1(it, "ATRD") ;
May this is one/some approach to implement it, but it gives slightly different numbers.



Return to “MultiCharts”