R
randomx
Guest
hat in hand
hi all,
i'm wondering if you guys can help me. the arrows on this script are not painting on the price chart. this is driving me craaazy. thank you in advance
what i need this script to do is
1] to paint an arrow down when there's an downward inflection on the sma line (dark red).
2] to paint an arrow up when there's an upward inflection on the sma line (cyan).
edit: here's a picture of what i mean.
dark red arrow down at the inflection point indicating the trend is going down
cyan arrow up indicating trend is going up, just at the inflection point
hi all,
i'm wondering if you guys can help me. the arrows on this script are not painting on the price chart. this is driving me craaazy. thank you in advance
what i need this script to do is
1] to paint an arrow down when there's an downward inflection on the sma line (dark red).
2] to paint an arrow up when there's an upward inflection on the sma line (cyan).
Code:
declare upper;
input price = close;
input length = 10;
input percent = 5;
input displace = 0;
def percent_deviation = percent / 100;
plot SMA = Average(price[-displace], length);
SMA.AssignValueColor(if SMA > SMA[1] and SMA[1] > SMA[2] then Color.cyan else if SMA < SMA[1] and SMA[1] < SMA [2] then Color.DARK_RED else Color.WHITE);
SMA.SetLineWeight(2);
plot five_percent_below_sma;
plot five_percent_above_sma;
five_percent_below_sma = (Average(price, length)) - (percent_deviation * Average(price, length));
five_percent_above_sma = (Average(price, length)) + (percent_deviation * Average(price, length));
five_percent_below_sma.SetDefaultColor(Color.gray);
five_percent_below_sma.SetPaintingStrategy(PaintingStrategy.LINE);
five_percent_above_sma.SetDefaultColor(Color.gray);
five_percent_above_sma.SetPaintingStrategy(PaintingStrategy.LINE);
addCloud(five_percent_below_sma, five_percent_above_sma, color.gray, color.gray);
##trend up
def asc_sma = SMA > SMA[1] and SMA[1] > SMA[2];
def long_signal = close crosses above asc_sma;
plot trendup = asc_sma and long_signal;
##trend down
def desc_sma = SMA < SMA[1] and SMA[1] < SMA[2];
def short_signal = close crosses below desc_sma;
plot trenddown = desc_sma and short_signal;
trendup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
trenddown.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
edit: here's a picture of what i mean.
dark red arrow down at the inflection point indicating the trend is going down
cyan arrow up indicating trend is going up, just at the inflection point
Last edited by a moderator: