Script to Scanner help, please

Code:
plot entry = if(close crosses above (lowestAll(low) + (ATR() *.7)), low, double.nan);
entry.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
plot exit = if((close crosses below highestAll(high) - (ATR() * .7)), high, double.nan);
exit.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);

I don't know how to code and have been trying to make this code into a scanner. This code is basically saying give me the highest high and lowest low on the chart and tell me when price pulls back the other way from it.

I want two scanners really unless we can make it into one with setting adjustments? One that will give me the highest high and one for the lowest low. I tried to just add it to the scan script and added "within 10 bars" but I didn't get any results. And I know there are results just by manually going through stocks and seeing there are.

Like I said I am really bad at coding so if this can be done and send me back a shareable link please? I have been trying for days but I have come to the point where I need to ask for help.
 
I don't know how to code and have been trying to make this code into a scanner. This code is basically saying give me the highest high and lowest low on the chart and tell me when price pulls back the other way from it.

I want two scanners really unless we can make it into one with setting adjustments? One that will give me the highest high and one for the lowest low. I tried to just add it to the scan script and added "within 10 bars" but I didn't get any results. And I know there are results just by manually going through stocks and seeing there are.

Like I said I am really bad at coding so if this can be done and send me back a shareable link please? I have been trying for days but I have come to the point where I need to ask for help.

What you have is perfect. Just add the scan the way I put it.

Ruby:
plot entry = if(close crosses above (lowestAll(low) + (ATR() *.7)), low, double.nan);
entry.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
plot exit = if((close crosses below highestAll(high) - (ATR() * .7)), high, double.nan);
exit.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);

plot Scan = (Entry or Exit);
     Scan.SetHiding();

For : Bull Custom Script Scan Query.

Ruby:
<YourScriptName>().Entry is true within 5 bars

For: Bear Custom Script Scan Query.

Ruby:
<YourScriptName>t().Exit is true within 5 bars
 
Last edited:

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

What you have is perfect. Just add the scan the way I put it.

Ruby:
plot entry = if(close crosses above (lowestAll(low) + (ATR() *.7)), low, double.nan);
entry.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
plot exit = if((close crosses below highestAll(high) - (ATR() * .7)), high, double.nan);
exit.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);

plot Scan = (Entry or Exit);
     Scan.SetHiding();

Ruby:
<YourScriptName>().Entry is true within 5 bars

Ruby:
<YourScriptName>t().Exit is true within 5 bars
Wait, the within 5 bars function isn't working. It's showing results for every stock with an up or down arrow? Is that because the code is wrong?
 
Code:
plot entry = if(close crosses above (lowestAll(low) + (ATR() *.7)), low, double.nan);
entry.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
plot exit = if((close crosses below highestAll(high) - (ATR() * .7)), high, double.nan);
exit.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);

I don't know how to code and have been trying to make this code into a scanner. This code is basically saying give me the highest high and lowest low on the chart and tell me when price pulls back the other way from it.

I want two scanners really unless we can make it into one with setting adjustments? One that will give me the highest high and one for the lowest low. I tried to just add it to the scan script and added "within 10 bars" but I didn't get any results. And I know there are results just by manually going through stocks and seeing there are.

Like I said I am really bad at coding so if this can be done and send me back a shareable link please? I have been trying for days but I have come to the point where I need to ask for help.
Does this repaint ?
 
For all that is asking question, This is not my code or my method. It's simply a solution provided to the question asked. Copy the while Script from comment #2, save it with a name. Ex: ATRSomething_Scan

https://usethinkscript.com/threads/script-to-scanner-help-please.11851/post-102169

for scanner queries refer back the the same comment, Remove other filters or select appropriate values you desire, As for the ATR entry/Exits, add a new filter as Study "Custom", click thinkscript editor Tab, and past the appropriate query.

You could adjust the within bars per choice 5 is only an example.

Also, Please don't run the scanner on the whole market, you are better off selecting your own Watch list or S&P500, another watchlist that has limited instruments.

-Surya
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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