Daily ATR calculation in TradeStation

Quote from EllisWyatt:

Your code looks correct, except for one aspect. I think the problem may be your use of the length parameter in the average function in the context of a 5 min chart. I think this would take the same data and averages it across 'n' 5 min bars, instead of 'n' Days as you probably intend.

Ellis I don't think that this is the problem, because even prior to referring to the Length, the DTR (as opposed to DATR) is providing an incorrect value.
 
Quote from ChoSingKum:

When you apply this (and any inidicator) for Data2, you have to make it based on Data2 otherwise it defaults to Data1.

In TradeStation 8.1:
Format Indicator - General tab - Base study on

Thanks for the formatting tip for displaying this indicator. Makes it a lot easier to check my coding.
 
Quote from Jock:

syswizard, refer to today's trading in April Light Crude.

Link to 5 min chart ...

http://www.futuresource.com/charts/charts.jsp?s=RCLJ07&o=&a=V:5&z=800x550&d=LOW&b=bar&st=
That's not a CHART, that's a JOKE !
Hopefully, ONE OF THESE DAYS, when open outcry is eliminated, these secondary electronic markets will start to show some "life" (i.e. liquidity).
Recent Story: a Hong Kong trader was trading the emini gold futures via my broker and started to complain about the order execution...and the fact he wasn't getting his stops filled properly. I looked at the market, and actually ran a few orders in sim mode, and sure enough, stop orders would get filled 2-5 ticks away from the stop price. I told him it was the market, NOT THE PLATFORM. He continued to complain to the broker about the platform having "bugs" and what-not. The broker ended-up terminating the guy's account.
Moral: trade in low liquidity instruments, and expect to get "hit" once in a while with a bad fill.
 
Quote from Pro_Trader720:

How about...

Code:
inputs: length(20);

vars: atr(0);

if d>d[1] then begin
    if atr=0 then atr=highd(1)-lowd(1) else atr=(((length-1)*atr)+(highd(1)-lowd(1)))/length;
end;

This appears to calculate the average range rather than the average "true" range. The ATR should take into account any unfilled gaps betwen the day's close and the next day's high or low.

It's when I start introducing the close into the calculation that I start running into problems.
 
Back
Top