Hi Team,
Could you please assist and assign the arrows to be plotted on the actual candle of the chart?
declare lower;
input length = 7;
input maxVolumeCutOff = 2.5;
input signalLength = 10;
input averageType = AverageType.EXPONENTIAL;
def OBV = TotalSum(Sign(close - close[1]) * volume);
plot OBVM = MovingAverage(averageType, OBV, length);
plot Signal = MovingAverage(averageType, OBVM, signalLength);
OBVM.SetDefaultColor(GetColor(8));
Signal.SetDefaultColor(GetColor(2));
input showarrows = yes;
def price = close ;
def up = OBVM > Signal and Signal < OBVM ;
def dn = OBVM < Signal and Signal > OBVM ;
def neutral = between(close,min(OBVM,SIGNAL),max(SIGNAL,OBVM));
def x = CompoundValue(1,
if x[1]>=0 and (dn[1] or up[1]==0) and up
then 1
else if x[1]>=1 and (up or !dn)
then x[1]+1
else 0, 1);
def y = CompoundValue(1,
if y[1]<=0 and (up[1] or dn[1]==0) and dn
then 1
else if y[1]>=1 and (dn or !up)
then y[1]+1
else 0, 1);
plot uparrow = if showarrows and x == 3 and up then 1 else 0;
uparrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
uparrow.SetLineWeight(1);
uparrow.SetDefaultColor(Color.yellow);
plot dnarrow = if showarrows and y == 3 and dn then 1 else 0;
dnarrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
dnarrow.SetLineWeight(1);
dnarrow.SetDefaultColor(Color.white);
#