thinkscript producing unexpected results

MitchInSF

New member
Hi Folks!

Such a rich community here, I figure I should just ask the wizards...Can someone tell me why this script is producing bizarre results?

Bizarre in that I get alerts on strong_BullishCondition and less than a minute later, I can get an update saying strong_BearishCondition. This is on a 3m /ES chart. What's going on here?

THANKS!!!



def myVWAP = VWAP();

def strong_BullishCondition = if volume > volume[1] and close > myVWAP and close > close[1]
then yes
else no;

def weak_BullishCondition = if volume > volume[1] and ( close > myVWAP or close > close[1] )
then yes
else no;

def weak_BearishCondition = if volume < volume[1] and ( close < myVWAP or close < close[1] )
then yes
else no;

def strong_BearishCondition = if volume < volume[1] and close < myVWAP and close < close[1]
then yes
else no;

AddLabel(yes,"VOLUME", if strong_bullishCondition then color.green else if weak_BullishCondition then color.dark_green else if weak_bearishCondition then color.dark_red else if strong_BearishCondition then color.red else color.gray);


Alert(strong_bullishCondition, "ES Strong VOLUME UP", Alert.BAR, Sound.Ding);
Alert(strong_BearishCondition, "ES Strong VOLUME DOWN", Alert.BAR, Sound.Ding);
 
Hi Folks!

Such a rich community here, I figure I should just ask the wizards...Can someone tell me why this script is producing bizarre results?

Bizarre in that I get alerts on strong_BullishCondition and less than a minute later, I can get an update saying strong_BearishCondition. This is on a 3m /ES chart. What's going on here?

THANKS!!!



def myVWAP = VWAP();

def strong_BullishCondition = if volume > volume[1] and close > myVWAP and close > close[1]
then yes
else no;

def weak_BullishCondition = if volume > volume[1] and ( close > myVWAP or close > close[1] )
then yes
else no;

def weak_BearishCondition = if volume < volume[1] and ( close < myVWAP or close < close[1] )
then yes
else no;

def strong_BearishCondition = if volume < volume[1] and close < myVWAP and close < close[1]
then yes
else no;

AddLabel(yes,"VOLUME", if strong_bullishCondition then color.green else if weak_BullishCondition then color.dark_green else if weak_bearishCondition then color.dark_red else if strong_BearishCondition then color.red else color.gray);


Alert(strong_bullishCondition, "ES Strong VOLUME UP", Alert.BAR, Sound.Ding);
Alert(strong_BearishCondition, "ES Strong VOLUME DOWN", Alert.BAR, Sound.Ding);


Try changing commented out myVWAP which is currently the fundamental price VWAP() to reference VWAP(), which is the indicator.

Ruby:
#def myVWAP = VWAP();
def myVWAP = reference VWAP();
AddLabel(1, myVWAP + "\n " + vwap());
 

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

Try changing commented out myVWAP which is currently the fundamental price VWAP() to reference VWAP(), which is the indicator.
Thanks!

The change is producing a different value (over 2 points difference at 05:01 EST).

3933.7754 vs 3931.6339

Comparing these results across different time frames, I see the fundamental price VWAP() producing a different result on each(!). Obviously, that's NOT what I want, so thank you for pointing this out!!

When you say fundamental price VWAP(), what does that mean?
 
Thanks!

The change is producing a different value (over 2 points difference at 05:01 EST).

3933.7754 vs 3931.6339

Comparing these results across different time frames, I see the fundamental price VWAP() producing a different result on each(!). Obviously, that's NOT what I want, so thank you for pointing this out!!

When you say fundamental price VWAP(), what does that mean?

It is price type like close, open, high, low, etc.. for the specific symbol. The referenced vwap() produces the value of the VWAP indicator.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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