200(SMA) or 55(MovExp) touch the current bar low

Hi Friends, Good evening !
Just a quick question, How do I write a scan when the 200 SMA touch the closing candle ( Just wanted to display the results if the SMA touch the low wick of the candle)

Example :


I was able to display the results when the 200 SMA touch last closed candle low wick, However, it displays even the 200 SMA touch the body.

The following scan I'm doing with the current setup:

Setting up a scan using SMA length 200 between SMA 1 open price and SAM 1 low price

I get the expected results for the positive closure by using the above scan... if it is closing negative getting false signal as I uses open.

Two scenarios:
1) If the closing candle is showing positive closure which has low wick , open, close, high wick(From the bottom). the result should display only 200 SMA touch low wick of the candle
2) if the closing candle is showing negative closure which has high wick,open, close, low wick (from the top), looking for only 200 sma touch low wick of the candle.

Pls. suggest ! Thanks in advanced.
 
Last edited:
you stated

"(Just wanted to display the results if the SMA touch the low wick of the candle)"

you can just use the wizard

price --> low ---> is equal to -----> study -----> moving average ---> 200
 

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

Thanks both of you for the response and help !
Sorry for not keeping the code which is being used...

Example : I just tested the following scenario using the following code but no luck.

1) low is equal to MovAvgExponential("price" = LOW, "length" = 55)."AvgExp"

2) low is equal to MovAvgExponential("price" = CLOSE, "length" = 55)."AvgExp"

3) low is equal to MovAvgExponential("price" = OPEN, "length" = 55)."AvgExp"


In this example: I'm looking for the results if the AvgExp 55 touch low wick of the candle (Not the body or high wick)..
If I look @ BL ticker , I see that Exponential Moving average 55 touch low wick of the candle. Here is the screen shot.

 
Add the TOS scan study filter below and play with the parameters. It works. Good luck.

MovingAvgCrossover(crossingType = "below")

Vbd4Xgs.png


cabe1332
 
if you dont want the body touching, then what you mean to say is that you want the

CLOSE to be greater than the moving average.
Low is equal to the moving average
 
Thanks both of you for the response and help !
Sorry for not keeping the code which is being used...

Example : I just tested the following scenario using the following code but no luck.

1) low is equal to MovAvgExponential("price" = LOW, "length" = 55)."AvgExp"

2) low is equal to MovAvgExponential("price" = CLOSE, "length" = 55)."AvgExp"

3) low is equal to MovAvgExponential("price" = OPEN, "length" = 55)."AvgExp"


In this example: I'm looking for the results if the AvgExp 55 touch low wick of the candle (Not the body or high wick)..
If I look @ BL ticker , I see that Exponential Moving average 55 touch low wick of the candle. Here is the screen shot.

Thanks for your response @XeoNoX

I used the same which you suggested in the last reply (low is equal to ) , don't want to keep less than as it display other tickers as well.
 
that will make it so the low, or the low wick is touching and EXACTLY equal to the 55 EMA
Code:
low is equal to MovAvgExponential("length" = 55)."AvgExp"

if your expecting to use this with a live scanner as a watchlist beware that the scanner only updates once every 3 to 5 mins and you will most likely miss when when the scan becomes true.
 
that will make it so the low, or the low wick is touching and EXACTLY equal to the 55 EMA
Code:
low is equal to MovAvgExponential("length" = 55)."AvgExp"

if your expecting to use this with a live scanner as a watchlist beware that the scanner only updates once every 3 to 5 mins and you will most likely miss when when the scan becomes true.

Thanks for your information. I'm using for Day chart... I tried to do with mentioned study..




Just to say , I'm able to get the list if I use the following code.

Need to find out the current candle status whether it is closed positively or negatively compare with previous day.

1) IF it is positive close(compare with previous day candle) :

a) Scan would be : Moving Average 55 between SMA1 open and SMA1 low (it display if the 55 touch the low wick of the candle)

2) If it is negative close (compare with previous day)

a) Scan would be : Moving Average 55 between SAM1 close and SAM1 low (it display the correct value)


If we don't have any other solution , I think the above cases should work.

Here is the question :

How do I include or do check if the candle is positive or negative with previous candle.



Thanks again for your help.
 
Last edited:
Just to say, I see the solution would be we need to verify whether the current candle closed (postievly or negative) wiht previous day.


Thanks for your information. I'm using for Day chart... I tried to do with mentioned study..




Just to say that,, I'm able to get the list if I use the following code.

Need to find out the current candle status whether it is closed positively or negatively compare with previous day.

1) IF it is positive close:

a) Scan would be : Moving Average 55 between SMA1 open and SMA1 low (it display if the 55 touch the low wick of the candle)

2) If it is negative close (compare with previous day)

a) Scan would be : Moving Average 55 between SAM1 close and SAM1 low (it display the correct value)


If we don't have any other solution , I think the above cases should work.

Here is the question :

How do I include or do check if the candle is positive or negative with previous candle.



Thanks again for your help.

@Stockmarker add a study filter on your watchlist under price performance then choose "Price_Direction". You can place with the parameters. Good luck.

cabe1332
 
@Stockmarker Try using crosses above within x bars and less than now type logic... Either your logic is wrong or the concept is beyond the capabilities of TOS... At any rate you have to test a price against MA more than one way on a single candle, if possible...
 
@Stockmaker I think you are looking at this all wrong which perhaps you didn't catch in my last post... Price touches MA, not MA touches Price... This is especially true the slower timeframe you work with... Go at this the right way and I think you will have better luck... I don't want to show you the code, I want you to work through the logic and come up with the result you desire... You'll learn more that way rather than me handing you working code... Change your train of thought and you'll get there...!!!
Thanks Rad for the offer. Happy to learn from you and community.

I tried with the following code.

"low is less than or equal to MovAvgExponential("price" = close, "length" = 55)."AvgExp""

(I used is "equal to" or "equals" in the code, it doesn't show up any results)

The above scan display the ticker which I'm looking for, and it shows some other tickers which I don't want as those tickers are not fall under my criteria .

Example : BL (this ticker is good ( the last candle low tickers touch 55 MA))
BLK ( the above displays this ticker as well as the 55 touch the body)

Still working on to see if I get the correct scan (if I'm doing wrong)
 
Thanks Rad for the offer. Happy to learn from you and community.

I tried with the following code.

"low is less than or equal to MovAvgExponential("price" = close, "length" = 55)."AvgExp""

(I used is "equal to" or "equals" in the code, it doesn't show up any results)

The above scan display the ticker which I'm looking for, and it shows some other tickers which I don't want as those tickers are not fall under my criteria .

Example : BL (this ticker is good ( the last candle low tickers touch 55 MA))
BLK ( the above displays this ticker as well as the 55 touch the body)

Still working on to see if I get the correct scan (if I'm doing wrong)
For time being, having the following code in the custom scan:

For the uptrend candle:

Code:
def sma200=MovAvgExponential("length" = 200)."AvgExp";
def smalow= SimpleMovingAvg("price" = LOW, "length" = 1)."SMA";
def smaopen= SimpleMovingAvg("price" = OPEN, "length" = 1)."SMA";

def up=sma200 between smalow and smaopen;

plot up1=up is true within 1 bar;

For the negative candle:

Code:
def sma200=MovAvgExponential("length" = 200)."AvgExp";
def smalow= SimpleMovingAvg("price" = LOW, "length" = 1)."SMA";
def smaopen= SimpleMovingAvg("price" = CLOSE, "length" = 1)."SMA";

def up=sma200 between smalow and smaopen;

plot up1=up is true within 1 bar;

As suggested by Ben, I may reach out to support team for this query.


Thanks and appreciated everyone for all help and information. Happy to be part of this group. Cheers.
 
Hi Everyone ! Good evening !
Sorry to trouble you, if I wanted to display the result set with the following code for the previous day?


Code:
declare lower;
def sma200=MovAvgExponential("length" = 200)."AvgExp";
def sma50=MovAvgExponential("length" = 50)."AvgExp";
def sma20=MovAvgExponential("length" = 20)."AvgExp";

def up=sma200 between sma50 and sma20 from 1 bar ago;
 
plot X=up is true;


I tried to run the scan but it is displaying the current day tickers... I tried to display the tickers for previous day by running today if the above statement is true ? not sure if I'm missing anything here? Can you pls check for me ?

Thanks for your help in advanced.
 
Hi Everyone ! Good evening !
Sorry to trouble you, if I wanted to display the result set with the following code for the previous day?


Code:
declare lower;
def sma200=MovAvgExponential("length" = 200)."AvgExp";
def sma50=MovAvgExponential("length" = 50)."AvgExp";
def sma20=MovAvgExponential("length" = 20)."AvgExp";

def up=sma200 between sma50 and sma20 from 1 bar ago;

plot X=up is true;


I tried to run the scan but it is displaying the current day tickers... I tried to display the tickers for previous day by running today if the above statement is true ? not sure if I'm missing anything here? Can you pls check for me ?

Thanks for your help in advanced.
Never mind. I got the answer.

I shall put up[1] is true which resolved my case. Thanks.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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