Based on Saty Mahajan's Golden Gate Strategy, I am trying to create a scanner (Simplified version below) (let's call it golden_gate_scanner) which relies on 4 things, "high", "low", "close" of last month and close price today (or 1 day before). Below is the algorithm.
Thank you.
- Based on the previous months high, low & close. We calculate the ATR value (Wilders) say atr.
- Using this expression (previous_month_close + (atr * 0.382)) we get a value, say upper_trigger
- Plot the upper_trigger & if today's close crosses it then the ticker should appear in our scan/watchlist.
- close is greater than or equal to golden_gate_scanner()."upper_trigger" with the aggregation period of "D".
Thank you.
Ruby:
input use_current_close = no;
input atr_length = 14;
def trading_period = AggregationPeriod.MONTH;
def previous_close = close(period = trading_period)[if use_current_close then 0 else 1];
def atr = Round(WildersAverage(TrueRange(high(period = trading_period), close(period = trading_period), low(period = trading_period)), atr_length)[if use_current_close then 0 else 1], 2);
def upper_0382 = previous_close + (atr * 0.382);
plot upper_trigger = upper_0382;