Hi all,
I am trying to combine the AccumDistPrVol and AccumDistBuyPr oscillators and capture the times when they come together at the same percentage as shown in the image I've attached of them both in the lower study (I put a circle around the part I'm talking about). When these two oscillators appear to come together as one, price moves much better so I would like to use this to create an alert and an upper study to color my candles. I just don't know how to compare the percentages correctly, apparently, because what I've done so far isn't working. I'm not sure if the line I've created is really needed; I just thought I could create one line and have the color change when the correct conditions are met. I appreciate any help you can provide.
#AccumDistPrVol code:
def AccDistVolPr = AccumDist(high, close, low, open, volume);
#AccDistVolPr.SetDefaultColor(GetColor(1));
#AccumDistBuyPr code:
def data = if close > close[1] then close - Min(close[1], low) else if close < close[1] then close - Max(close[1], high) else 0;
def AccDist = TotalSum(data);
#AccDist.SetDefaultColor(GetColor(1));
def BothLines = AccDistVolPr + AccDist;
def BothMatch = (AccDistVolPr == AccDist);
plot AccumLine = BothLines;
AccumLine.SetPaintingStrategy(PaintingStrategy.Line);
AccumLine.AssignValueColor(if BothMatch then Color.GREEN else Color.GRAY);
AccumLine.SetLineWeight(2);
I am trying to combine the AccumDistPrVol and AccumDistBuyPr oscillators and capture the times when they come together at the same percentage as shown in the image I've attached of them both in the lower study (I put a circle around the part I'm talking about). When these two oscillators appear to come together as one, price moves much better so I would like to use this to create an alert and an upper study to color my candles. I just don't know how to compare the percentages correctly, apparently, because what I've done so far isn't working. I'm not sure if the line I've created is really needed; I just thought I could create one line and have the color change when the correct conditions are met. I appreciate any help you can provide.
#AccumDistPrVol code:
def AccDistVolPr = AccumDist(high, close, low, open, volume);
#AccDistVolPr.SetDefaultColor(GetColor(1));
#AccumDistBuyPr code:
def data = if close > close[1] then close - Min(close[1], low) else if close < close[1] then close - Max(close[1], high) else 0;
def AccDist = TotalSum(data);
#AccDist.SetDefaultColor(GetColor(1));
def BothLines = AccDistVolPr + AccDist;
def BothMatch = (AccDistVolPr == AccDist);
plot AccumLine = BothLines;
AccumLine.SetPaintingStrategy(PaintingStrategy.Line);
AccumLine.AssignValueColor(if BothMatch then Color.GREEN else Color.GRAY);
AccumLine.SetLineWeight(2);