Supply and demand zones indicator thinkorswim

broken image
broken image

Rec data1 = CompoundValue(1, if (zzSave = high(period=timeframe) or zzSave = low(period=timeframe)) then data1 + 1 else data1, 0) ĭef datacount1 = (HighestAll(data1) - data1) Rec isConf = AbsValue(chg) >= reversalAmount or (IsNaN(GetValue(zz, 1)) and GetValue(isConf, 1)) ĭef zzL = if !IsNaN(zz) and !isUp then low(period=timeframe) else GetValue(zzL, 1) ĭef zzH = if !IsNaN(zz) and isUp then high(period=timeframe) else GetValue(zzH, 1) ĭef dir = CompoundValue(1, if zzL != zzL or low(period=timeframe)=zzl and low(period=timeframe)=zzsave then 1 else if zzH != zzH or high(period=timeframe)=zzh and high(period=timeframe)=zzsave then -1 else dir, 0) ĭef signal = CompoundValue(1, if dir > 0 and low(period=timeframe) > zzL then if signal = 0 then -1 else signal else signal, 0)

broken image

Input timeframe = aggregationperiod.fifTEEN_MIN ĭef zz = ZigZagHighLow('price h' = high(period=timeframe), 'price l' = low(period=timeframe), 'percentage reversal' = percentamount, 'absolute reversal' = revAmount, 'atr length' = atrlength, 'atr reversal' = atrreversal) ĭef reversalAmount = if (close(period=timeframe) * percentamount / 100) > Max(revAmount = 0

broken image