New study by Mobius. What do you all think?
https://tos.mx/eWDyyVP
https://www.mytrade.com/profile/Mobius/statuses/16089103
Code:
# These attributions and study notes are part of the study code.
# Average True Range Implied Move
# Mobius
# V01.08.22.2020
# Notes: Chart data must be intraday. Extended Hours must be turned on. Chart data must include the data needed to calculate the highest Average True Range (10 days of data to calculate a 10 day Average True Range). For lower aggregations (5 minute and less) Settings > Price Axis > Fit Studies may need to be checked yes to show ATR Daily limit lines. If using on a thinly traded equity there may not be a trade at the RTH open and the Daily Implied Move may not plot for that day.
# Study Limitation: Average True Range is an average of the averaged bars range. Tying that average to any fixed point on a bar makes the erroneous assumption that the range is equal distance from that point. This study divides ATR in half and plots half above and half below the open of whatever aggregation period the user inputs. In order to keep chart clutter at a minimum the study plot only the most recent range. If the expansion area is set wide enough for the next period open to display then lines will begin plotting in the expansion area instead of at the current price bar.
input ATRlength = 10;
input Agg_1 = AggregationPeriod.Day;
input Agg_2 = AggregationPeriod.hour;
def o = open;
def h = high;
def l = low;
def c = close;
def o_1 = open(period = Agg_1);
def h_1 = high(period = Agg_1);
def l_1 = low(period = Agg_1);
def c_1 = close(period = Agg_1);
def o_2 = open(period = Agg_2);
def h_2 = high(period = Agg_2);
def l_2 = low(period = Agg_2);
def c_2 = close(period = Agg_2);
def x = barNumber();
def nan = double.nan;
def ts = TickSize();
def ATR_1 = Average(TrueRange(h_1[1], c_1[1], l_1[1]), ATRlength);
def ATR_2 = Average(TrueRange(h_2[1], c_2[1], l_2[1]), ATRlength);
def RTHo = getTime() crosses above RegularTradingStart(getYYYYMMDD());
def Y1 = if RTHo
then o
else Y1[1];
def x1 = if RTHo
then x
else x1[1];
def a1 = if RTHo
then round((ATR_1 / 2) / ts, 0) * ts
else a1[1];
plot RTHopen = if x >= highestAll(x1)
then highestAll(if isNaN(c[1])
then Y1
else nan)
else nan;
RTHopen.SetStyle(Curve.Long_Dash);
RTHopen.SetLineWeight(3);
RTHopen.SetDefaultColor(Color.Yellow);
RTHopen.HideTitle();
plot Dh = RTHopen + a1;
Dh.SetStyle(Curve.Short_Dash);
Dh.SetLineWeight(2);
Dh.SetDefaultColor(Color.Green);
Dh.HideTitle();
plot Dl = RTHopen - a1;
Dl.SetStyle(Curve.Short_Dash);
Dl.SetLineWeight(2);
Dl.SetDefaultColor(Color.Red);
Dl.HideTitle();
def Y2 = if getTime() % Agg_2 == 0
then o_2
else Y2[1];
def x2 = if o == o_2 and getTime() % Agg_2 == 0
then x
else x2[1];
def a2 = if getTime() % Agg_2 == 0
then round((ATR_2 / 2) / ts, 0) * ts
else a2[1];
plot open_2 = if x >= highestAll(x2)
then highestAll(if isNaN(c[1])
then Y2
else nan)
else nan;
open_2.SetStyle(Curve.Long_Dash);
open_2.SetLineWeight(1);
open_2.SetDefaultColor(Color.Yellow);
open_2.HideTitle();
plot O2_h = open_2 + a2;
O2_h.SetStyle(Curve.Short_Dash);
O2_h.SetLineWeight(1);
O2_h.SetDefaultColor(Color.Green);
O2_h.HideTitle();
plot O2_l = open_2 - a2;
O2_l.SetStyle(Curve.Short_Dash);
O2_l.SetLineWeight(1);
O2_l.SetDefaultColor(Color.Red);
O2_l.HideTitle();
# End Code
https://tos.mx/eWDyyVP
https://www.mytrade.com/profile/Mobius/statuses/16089103
Last edited by a moderator: