Combined AccumDistPrVol and AccumDistBuyPr Oscillators

msmmlee

New member
Plus
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);
 

Attachments

  • TwoAccumOscillators.png
    TwoAccumOscillators.png
    26.4 KB · Views: 44

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
241 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top