Help with plot on study

PT_Scalper

Member
VIP
Hi all,

I modified a few studies to create this;

def EMA21 = ExpAverage(close, 21);
def EMA50 = ExpAverage(close, 50);
def EMA200 = ExpAverage(close, 200);

def Up2150200 = EMA21 > EMA50 and EMA21 > EMA200 and EMA50 > EMA200;
def Up5021200 = EMA21 < EMA50 and EMA21 > EMA200 and EMA50 > EMA200;
def Up5020021 = EMA21 < EMA50 and EMA21 < EMA200 and EMA50 > EMA200;
def Up2120050 = EMA21 > EMA50 and EMA21 > EMA200 and EMA50 < EMA200;
def Up2002150 = EMA21 > EMA50 and EMA21 < EMA200 and EMA50 < EMA200;
def Up2005021 = EMA21 < EMA50 and EMA21 < EMA200 and EMA50 < EMA200;

AddLabel(Up2150200, “Strong Bullish”, Color.DARK_GREEN);
AddLabel(Up5021200, “Bearish > 200”, Color.CYAN);
AddLabel(Up5020021, “Bearish > 200”, Color.DOWNTICK);
AddLabel(Up2120050, “Bullish < 200”, Color.UPTICK);
AddLabel(Up2002150, “Bullish < 200”, Color.ORANGE);
AddLabel(Up2005021, “Strong Bearish”, Color.DARK_RED);
AddLabel(Up2005021, “Strong Bearish”, color.Dark_Red);
I'm really struggling trying to figure out how to add an arrow or vertical line for each of the conditions with the matching colors.

Can anyone help? I prefer the vertical line as it's much easier to see on the chart.

Thanks,
EarlyAMTrader
 
Last edited by a moderator:
Solution
you have the logic conditions, just need to add one to a plot.
you can use boolean painting strategies or non.


boolean , plot a 1 or 0, a true or false. object will be placed just above or below a candle.
Ruby:
plot z = Up2150200;
z.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_up);
z.SetLineWeight(4);
z.setdefaultcolor(color.green);


plot a price value, to place an object anywhere on chart
Ruby:
plot w = if Up2150200 then low else double.nan;
w.SetPaintingStrategy(PaintingStrategy.ARROW_up);
w.SetLineWeight(4);
w.setdefaultcolor(color.green);

https://tlc.thinkorswim.com/center/reference/thinkScript/Constants/PaintingStrategy
you have the logic conditions, just need to add one to a plot.
you can use boolean painting strategies or non.


boolean , plot a 1 or 0, a true or false. object will be placed just above or below a candle.
Ruby:
plot z = Up2150200;
z.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_up);
z.SetLineWeight(4);
z.setdefaultcolor(color.green);


plot a price value, to place an object anywhere on chart
Ruby:
plot w = if Up2150200 then low else double.nan;
w.SetPaintingStrategy(PaintingStrategy.ARROW_up);
w.SetLineWeight(4);
w.setdefaultcolor(color.green);

https://tlc.thinkorswim.com/center/reference/thinkScript/Constants/PaintingStrategy
 
Solution

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
467 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