This allows an input option to show crossover arrows.
So I was given the stochastic Momentum Index with buy and sell arrows at the crossovers. But the study shows in the lower section and not for the upper chart windows. I would like the crossover buy and crossover sell arrows from the StochasticMomentumIndex show in the upper chart with the candle sticks so I do not have to look at the lower study. Can someone help me with this please. I hope I explained it well.
Below is what I was given. I am looking to get those arrows into the candle stick chart chart upper area..not the lower study area. And to show the arrows exactly as it hits the crossover..not after it passes. Thank you so much.
#
# TD Ameritrade IP Company, Inc. (c) 2008-2022
#
declare lower;
input crossover_arrows = yes;
input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;
def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;
def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);
plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
SMI.SetDefaultColor(GetColor(1));
plot AvgSMI = ExpAverage(SMI, percentDLength);
AvgSMI.SetDefaultColor(GetColor(5));
plot overbought = over_bought;
overbought.SetDefaultColor(GetColor(5));
plot oversold = over_sold;
oversold.SetDefaultColor(GetColor(5));
#Arrows
plot uparrow = if !crossover_arrows then Double.NaN
else if SMI crosses above AvgSMI
then SMI
else Double.NaN;
uparrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
uparrow.SetLineWeight(3);
uparrow.SetDefaultColor(GetColor(1));
plot dnarrow = if !crossover_arrows then Double.NaN
else if SMI crosses below AvgSMI
then SMI
else Double.NaN;
dnarrow.SetPaintingStrategy(PaintingStrategy.ARROW_DoWN);
dnarrow.SetLineWeight(3);
dnarrow.SetDefaultColor(GetColor(5));
Last edited by a moderator: