Looking to get Randomwalkindex(6) highline crossing lowline with an up arrow on the upper chart.
Code:
#
# Charles Schwab & Co. (c) 2010-2025
#
declare lower;
input length = 8;
def TR = TrueRange(high, close, low);
plot LowLine = fold index1 = 1 to length + 1 with max1 do Max(max1, (getValue(high, index1, length) - low) / ((fold ATRIndex1 = 1 to index1 + 2 with ATR1 do ATR1 + getValue(TR, ATRIndex1, length + 1)) / (index1 + 1) * Sqrt(index1 + 1)));
plot HighLine = fold index2 = 1 to length + 1 with max2 do Max(max2, (high - getValue(low, index2, length)) / ((fold ATRIndex2 = 1 to index2 + 2 with ATR2 do ATR2 + getValue(TR, ATRIndex2, length + 1)) / (index2 + 1) * Sqrt(index2 + 1)));
plot MiddleLine = 1;
LowLine.setDefaultColor(getColor(1));
HighLine.SetDefaultColor(GetColor(5));
MiddleLine.SetDefaultColor(GetColor(8));
Last edited by a moderator: