Need help with Syntax

Cmeeker778

New member
plot arrow_up = open("period" = AggregationPeriod.FIVE_MIN); RSI crosses above 30 within 1 bar + StochasticFast crosses above 20;

basically I'm trying to plot a boolean up or down arrow at the the open of a 5 min price bar; based on RSI, Momentum and Stochastic fast slope; or cross above the oversold/overbought areas

I've never written an indicator so any help would be much appreciated!
 
@Cmeeker778 - Here's something that can help, not certain how you are trying to do the higher aggregation though. This code will find these conditions on whatever timeframe you are viewing.

Code:
def rsi = RSI() crosses above 30 within 1 bar;
def sto = StochasticFast() crosses above 20;

plot arrow_up = rsi and sto;
     arrow_up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
 
@Cmeeker778 Well, as long as you are on the 5 min timeframe, the arrows will plot based on the 5 min RSI and the 5 min StochasticFast, no aggregation period needed. Now if you decide to go to a 3 or 1 min chart, the arrows will be based on the 3 or 1 min timeframes unless you hard code the referenced indicators to use a 5 min aggregation. Otherwise, no agg period needs to be coded in.

The above code will give you an arrow every time the plot is true, otherwise, no arrow will be seen.
 
@Cmeeker778 Probably. How do you define a "change of slope" and what is is the plot that is changing?
I'm working with this. Not quite where or how I want it, but its a start.

def rsi = isascending(open, 30);
def sto = isascending(open, 20); plot arrow_up= (rsi and sto); arrow_up.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
def rsi = isdescending(open, 70);
def sto = isadescending(open, 80); plot arrow_down= (rsi and sto); arrow_down.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
 
You may want to rename your second set of variables, the ThinkScript editor wont accept it as currently coded. However, there is no reference to either the RSI or the StochasticFast in that code. When you are using "IsAscending" and "IsDecending", your code seems to be comparing the open price to the (open+close)/2 of the last 30,20,70,or 80 price bars. See https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Tech-Analysis/IsAscending and https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Tech-Analysis/IsDescending. If you are simply trying to find if the current RSI value is greater than the previous RSI value, maybe try something like def up = RSI() > RSI()[1];. Unless I'm just not comprehending what you are trying to do. :unsure:
 
You may want to rename your second set of variables, the ThinkScript editor wont accept it as currently coded. However, there is no reference to either the RSI or the StochasticFast in that code. When you are using "IsAscending" and "IsDecending", your code seems to be comparing the open price to the (open+close)/2 of the last 30,20,70,or 80 price bars. See https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Tech-Analysis/IsAscending and https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Tech-Analysis/IsDescending. If you are simply trying to find if the current RSI value is greater than the previous RSI value, maybe try something like def up = RSI() > RSI()[1];. Unless I'm just not comprehending what you are trying to do. :unsure:
Okay thanks! Ya just want to populate a directional up arrow as the RSI and Stochastic started to accelerate higher; past the overbought/oversold levels.
My intention for "open" was to plot an arrow at the open price when a new five 5 min pops up.

I'm using these for scalp trades in binary options
I'll give your input a shot! thank you.
 
Last edited:

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