Reduce Number of Down Arrows

N

Nick

Active member
2019 Donor
VIP
Hi all, this is my attempt to construct a simple indicator. The code are attached below, the problem i have is too many down white arrows, when the condition is met.



May i request some help from this great community

1. what is the difference when using MovAvgExponential(low, 10) vs MovAvgExponential(close, 10). How does the LOW and CLOSE affect the plot?

2. From the pic, you noticed that there are lots of white down arrows, I would like to see only TWO white down arrows. How to amend this script to only plot TWO white down arrows, max 2, when the condition3_Dwn is met.

Thank you very much

Code:
def Trend = MovAvgExponential(low, 10);
plot MA_color = Trend;
MA_color.AssignValueColor(if close > MA_color then color.green else color.red);

#CCI_
input length = 14;
input over_sold = -100;
input over_bought = 100;

def price = close + low + high;
def linDev = LinDev(price, length);
def CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
def ZeroLine = 0;

def condition1u = close > trend;
def condition2u = CCI crosses above over_sold;
plot pUp = condition1u and condition2u;# and trendup;
pUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
pUp.SetLineWeight(5);
pUp.AssignValueColor(Color.bLUE);

#
def condition3_Dwn = close < Trend;
plot Exit = condition3_dwn;
Exit.SetPaintingStrategy(PaintingStrategy.BOOLEAN_Arrow_Down);
Exit.SetLineWeight(1);
Exit.AssignValueColor(Color.WHITE);

@BenTen @markos Thanks for all the guidance....really appreciate it.
 
Last edited by a moderator:
BenTen

BenTen

Administrative
Staff
VIP
  • Low = the candlestick's lowest price.
  • Close = the candlestick's closing price.
Yes, both will affect the plot. Normally, we use close in our scripts.

Why do you only want to see 2 arrows? I'm a bit confused.
 
N

Nick

Active member
2019 Donor
VIP
@BenTen, the reasons why i was considering only two arrows is to avoid having the chart full of down arrows, esp when we get choppy charts. I am not sure what condition statement i can use to only plot only.,..one arrow. I think another alternative is to change the condition to have two moving averages crossover and provide a down arrow for simplicity.
 
horserider

horserider

Well-known member
VIP
@Nick Just from looking at it, why not try this. Not tested so who knows what you will get.

def condition3d = CCI crosses below over_bought;
plot Exit = condition3_dwn and condition3d;
 
N

Nick

Active member
2019 Donor
VIP
@Nick Just from looking at it, why not try this. Not tested so who knows what you will get.

def condition3d = CCI crosses below over_bought;
plot Exit = condition3_dwn and condition3d;
Thank you.
 

Similar threads

Top