9/30 Trading strategy is this even possible with TOS

irfantastic000

New member
Is this indicator even possible with TOS?

Following conditions:
-Chart : 5 minutes
-EMA : 9
-WMA : 30
-The trend should be bullish when the 9 EMA is above the 30 WMA
-The gap should be bigger between 9 EMA and 30 WMA
-The angle should be steeper

Once the above condition is met then either of the 2 conditions should be met.
1. The first candle bar that closes below the 9-EMA and remains above the 30-WMA
2. The entire candle bar to be encompassed between the 9-EMA and 30-WMA.

Example :
 
Is this indicator even possible with TOS?

Following conditions:
-Chart : 5 minutes
-EMA : 9
-WMA : 30
-The trend should be bullish when the 9 EMA is above the 30 WMA
-The gap should be bigger between 9 EMA and 30 WMA
-The angle should be steeper

Once the above condition is met then either of the 2 conditions should be met.
1. The first candle bar that closes below the 9-EMA and remains above the 30-WMA
2. The entire candle bar to be encompassed between the 9-EMA and 30-WMA.

Example :

yes, this can be done. i have a couple of questions.

gap is bigger than what? when?
( gap should be bigger between 9 EMA and 30 WMA)

steeper than what? when?
(The angle should be steeper)

what happens when a last condition is met? (either of the 2 conditions)
 

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

The answer to all 3 is when all conditions are met then TOS script should identify this pattern and alert me that the pattern is form and its time to buy in the very next candle.

Basically bigger the gap means bullish....steeper the angle means bullish and the last of either of the conditions is the signal to place a Buy order.
 
The answer to all 3 is when all conditions are met then TOS script should identify this pattern and alert me that the pattern is form and its time to buy in the very next candle.

Basically bigger the gap means bullish....steeper the angle means bullish and the last of either of the conditions is the signal to place a Buy order.

When writing these things in code they need to be defined precisely.

By bigger gap, I'm assuming you mean the range between the MAs is larger on the current candle than it was on the previous candle.

Steeper refers to what? The MAs also or something else? If it's something else, what, and over what period of time? If it's the MAs, are you meaning this as a synonym with wider gap or you want to also see an increase in the rate of change of both MAs or just one?

The final two conditions are really the same condition. Close between the MAs.

I'm assuming you realize "place a Buy order" doesn't actually automate any trades and just draws an entry signal on your chart.
 
When writing these things in code they need to be defined precisely.

By bigger gap, I'm assuming you mean the range between the MAs is larger on the current candle than it was on the previous candle.

Steeper refers to what? The MAs also or something else? If it's something else, what, and over what period of time? If it's the MAs, are you meaning this as a synonym with wider gap or you want to also see an increase in the rate of change of both MAs or just one?

The final two conditions are really the same condition. Close between the MAs.

I'm assuming you realize "place a Buy order" doesn't actually automate any trades and just draws an entry signal on your chart.
I can't explain how the gap should be. I am a newbie in trading so I am learning every day.

For example below chart is for $NAOV today.
Yellow line: 9 EMA
Red dotted line: 30 WMA
Right, that candle at 8.10 am CT just before the market opens is the perfect signal to enter as per my last condition. The entire candle has closed between the 9-EMA and 30-WMA. You can check how the price went today for $NAOV.

 
Being new to trading, congrats on having an actual strategy and not just buying based on what you think will happen. And on using a strategy that has you buying near some kind of support.

In that image, since this is a pullback the EMA is actually moving toward the WMA and narrowing the gap on your signal candle. It's not until after your entry, and price going the way you want it to, that the gap gets wider.

This implements your rules. You can control how wide of a gap is required by increasing/decreasing the minGapAtr input, which is based on AverageTrueRange.

Ruby:
input minGapAtr = 1.0;

def ema = ExpAverage(close, 9);
def wma = wma(close, 30);

def buySignal =
  ema > wma + reference ATR * minGapAtr
  and close[1] > ema
  and Between(close, wma, ema)
;

plot Buy = buySignal;
Buy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Buy.SetDefaultColor(Color.WHITE);
 
Last edited:
Being new to trading, congrats on having an actual strategy and not just buying based on what you think will happen. And on using a strategy that has you buying near some kind of support.

In that image, since this is a pullback the EMA is actually moving toward the WMA and narrowing the gap on your signal candle. It's not until after your entry, and price going the way you want it to, that the gap gets wider.

This implements your rules. You can control how wide of a gap is required by increasing/decreasing the minGapAtr input, which is based on AverageTrueRange.

Ruby:
input minGapAtr = 1.0;

def ema = ExpAverage(close, 9);
def wma = wma(close, 30);

def buySignal =
  ema > wma + reference ATR * minGapAtr
  and close[1] > ema
  and Between(close, wma, ema)
;

plot Buy = buySignal;
Buy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Buy.SetDefaultColor(Color.WHITE);
Amazing. I was just asking if this was even possible and you made a script. Thanks a ton, can't express my gratitude. 🙌

Few questions:
1. What is the range or minGapAtr, upperlimit and lower limit?
2. What is SetPaintingStrategy line of code?
3. What is SetDefaultColor, what do you mean by White?
4. Where do you define if the candle should close between the 2 lines?
5. If I use this with my following scanner setting, the 4th custom one is where the script is. When this trend is built by any stock chart then this should pop up in my scan results? 6. With my above settings no results are found but if I remove the '% change' then I can see some results.
 
Amazing. I was just asking if this was even possible and you made a script. Thanks a ton, can't express my gratitude. 🙌

Few questions:
1. What is the range or minGapAtr, upperlimit and lower limit?
2. What is SetPaintingStrategy line of code?
3. What is SetDefaultColor, what do you mean by White?
4. Where do you define if the candle should close between the 2 lines?
5. If I use this with my following scanner setting, the 4th custom one is where the script is. When this trend is built by any stock chart then this should pop up in my scan results? 6. With my above settings no results are found but if I remove the '% change' then I can see some results.
1. 0 to infinity. It's measuring how far the price moves on an average day. Then later code requires a gap some multiple of that range. That way it works well whether the stock price is $10 or $1000 and whether the price recently moved a little or a lot per day. It's averaging 14 days.
2. That tells it to draw arrows pointing upward instead of a line or something else.
3. That makes the color of the arrows white unless you change the color in the settings.
4. and Between(close, wma, ema)
5. Yes, you can use that in the scanner.
6. Yes, other filters may limit your results.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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