attached is the great code for the SATY Phase Oscillator
https://www.satyland.com/phaseoscillator
, which shows tickers in compression (Bollinger) or exiting compression into accumulation or distribution
i can't quite make it into a code that will populate a watchlist with tickers that are now in day 1 of accum. coming out of compression, or VICE/VERSA
any thoughts????
# Compression Tracker and Oscillator Signal
def pivot = ExpAverage(close, 21);
def above_pivot = close >= pivot;
def oscillator_signal = Round(ExpAverage(((close - pivot) / (3.0 * ATR(14))) * 100, 3), 2);
# Bollinger Band Compression Signal
def bband_offset = 2.0 * STDev(close, 21);
def bband_up = pivot + bband_offset;
def bband_down = pivot - bband_offset;
def compression_threshold_up = pivot + (2.0 * ATR(14));
def compression_threshold_down = pivot - (2.0 * ATR(14));
def expansion = compression_threshold_up < bband_up and compression_threshold_down > bband_down;
# Compression State (WHITE)
def compression_tracker = if expansion then 0 else 1;
# Accumulation State (GREEN)
def in_accumulation = oscillator_signal <= -61.8 and oscillator_signal > -100;
# Transition from Compression to Accumulation
def exited_compression_to_accumulation = (compression_tracker[1] == 1 and in_accumulation[1]);
# 2nd Day of Accumulation
def second_day_accumulation = exited_compression_to_accumulation[1] and in_accumulation;
# Scan Condition
plot scan = second_day_accumulation;
https://www.satyland.com/phaseoscillator
, which shows tickers in compression (Bollinger) or exiting compression into accumulation or distribution
i can't quite make it into a code that will populate a watchlist with tickers that are now in day 1 of accum. coming out of compression, or VICE/VERSA
any thoughts????
# Compression Tracker and Oscillator Signal
def pivot = ExpAverage(close, 21);
def above_pivot = close >= pivot;
def oscillator_signal = Round(ExpAverage(((close - pivot) / (3.0 * ATR(14))) * 100, 3), 2);
# Bollinger Band Compression Signal
def bband_offset = 2.0 * STDev(close, 21);
def bband_up = pivot + bband_offset;
def bband_down = pivot - bband_offset;
def compression_threshold_up = pivot + (2.0 * ATR(14));
def compression_threshold_down = pivot - (2.0 * ATR(14));
def expansion = compression_threshold_up < bband_up and compression_threshold_down > bband_down;
# Compression State (WHITE)
def compression_tracker = if expansion then 0 else 1;
# Accumulation State (GREEN)
def in_accumulation = oscillator_signal <= -61.8 and oscillator_signal > -100;
# Transition from Compression to Accumulation
def exited_compression_to_accumulation = (compression_tracker[1] == 1 and in_accumulation[1]);
# 2nd Day of Accumulation
def second_day_accumulation = exited_compression_to_accumulation[1] and in_accumulation;
# Scan Condition
plot scan = second_day_accumulation;
Last edited by a moderator: