Does anyone know how to make the following changes to this indicator?
1. Paint the candlesticks the same color as the lines above and below the candlesticks
2. Have an option to change the moving average type (simple, exponential, weighted, wilders, hull)
https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/G-L/HiLoActivator
input length = 3;
def maHigh = Average(high, length);
def maLow = Average(low, length);
def state = {default init, short, long};
if (close > maHigh) {
state = state.long;
} else if (close < maLow) {
state = state.short;
} else {
state = state[1];
}
plot BuyStop = if state == state.short or state != state[1] then maHigh else Double.NaN;
plot SellStop = if state == state.long or state != state[1] then maLow else Double.NaN;
BuyStop.SetDefaultColor(GetColor(0));
SellStop.SetDefaultColor(GetColor(1));
1. Paint the candlesticks the same color as the lines above and below the candlesticks
2. Have an option to change the moving average type (simple, exponential, weighted, wilders, hull)
https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/G-L/HiLoActivator
input length = 3;
def maHigh = Average(high, length);
def maLow = Average(low, length);
def state = {default init, short, long};
if (close > maHigh) {
state = state.long;
} else if (close < maLow) {
state = state.short;
} else {
state = state[1];
}
plot BuyStop = if state == state.short or state != state[1] then maHigh else Double.NaN;
plot SellStop = if state == state.long or state != state[1] then maLow else Double.NaN;
BuyStop.SetDefaultColor(GetColor(0));
SellStop.SetDefaultColor(GetColor(1));