Increasing Volume as Price Crosses 9 period SMA

First time here. Just looking for a way, a function or a condition of some sort to meet these conditions

So my current code looks something like this:
plot Pricecross = close >= SimpleMovingAvg() and Volume crosses above Volume [-1];

I have also tried this
plot PriceCross = close crosses above SimpleMovingAvg() and if volume crosses above volume()[-1] then 1 else 0;

This works because it indicates when the price crosses the average, however from what I understand when the script is running its checking the and part of the script and making sure that each successive candle has more volume than the previous, I don't want this to happen. What I want to occur with the script is when the price crosses the moving average, the volume is greater than the previous candle. I'm not asking for my hand held (not that I wouldn't mind) but I'd greatly appreciate it if anyone can give me the tools to make it work. (TOS thinkscript website is kinda barebones).

If it is not possible or I need to elaborate further please let me know.
@Quinefine Trader
plot Pricecross = close crosses above SimpleMovingAvg() and Volume > Volume [1];
I appreciate the reply but that doesn't seem to work as it will return the value to 0 on the first bar the volume is not greater than the previous.

I only want to 'check' if the volume is greater than the bar previous IF the close crosses the SMA. (I'm not angry or anything I'm just trying desperately not to confuse anyone who tries to help haha)
@Quinefine Trader Like this?
plot Pricecross = if close >= SimpleMovingAvg() then if Volume > Volume [1] then 1 else 1 else 0;

I got it to work. It was just the matter of changing the cross to greater than! maybe I can change the if statement more and make a third condition where the price is less than and the volume goes up? I don't know. I wouldn't have gotten it without your help. For anyone to reference, above is the modified script
Not sure I understand the logic of this code, but shouldn't it be something like:
plot Pricecross = if close >= SimpleMovingAvg() and Volume > Volume [1] then 1 else 0

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
363 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.