Scanning For The Past

#Scan for Stockbee Combo Scan

#This is a scan

def day_range = Round(((close - low) / (high - low)) * 100, 0);

plot bull_combo= if ((Close-Open)>=.90 and (Close[1]-Open[1])<(Close-Open) and day_range>=70 and Volume>100000 and (Close[1]/Close[2])<1.02) or ((Close/Close[1])>=1.04 and Volume>Volume[1] and day_range>=70 and Volume>100000 and (Close[1]/Close[2])<1.02 and Close>=3) then 1 else 0;

Code:
#Combo Bearish Scan for ToS

def minvol3=lowest(volume,3);

plot signal= ((open-close)>=.90 and volume>=100000 and (open[1]-close[1])<(open-close) and Close>=3 and minvol3>=100000) or ((Close/Close[1])<=0.96 and Volume>Volume[1] and volume>=100000 and (Close[1]/Close[2])>=.98 and Close>=3 and minvol3>=100000);


this is a scan which shows which stocks has move more than 4% today when i run it today.
As i want to see the result from yesterday , or even days 3, 4, 5 days in the past so i can backtest it.
Is there a way to add a length option in it scan for historical days?
 
Solution
anyone can help to create a script for to search for reversal daily candle in the past maybe up to 5 days(customizable day) .


Code:
#Past 5 days reversal candle
def reversalcandle1 = (AbsValue(close - high ) > 6 * AbsValue ( open - close ) and AbsValue(close - open ) < .1 * AbsValue ( high - low ));
def reversalcandle2 = (AbsValue(close - low ) > 6 * AbsValue ( open - close ) and AbsValue(close - open ) < .1 * AbsValue ( high - low )) ;

input daysLookBack = 5;
plot scan = true(reversalcandle1 , daysLookBack);


look at my upper study, it uses sum() to check if a condition happened
https://usethinkscript.com/threads/problem-with-using-scan-and-fold.12917/#post-109706
anyone can help to create a script for to search for reversal daily candle in the past maybe up to 5 days(customizable day) .


Code:
#Past 5 days reversal candle
def reversalcandle1 = (AbsValue(close - high ) > 6 * AbsValue ( open - close ) and AbsValue(close - open ) < .1 * AbsValue ( high - low ));
def reversalcandle2 = (AbsValue(close - low ) > 6 * AbsValue ( open - close ) and AbsValue(close - open ) < .1 * AbsValue ( high - low )) ;

input daysLookBack = 5;
plot scan = true(reversalcandle1 , daysLookBack);
 

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

anyone can help to create a script for to search for reversal daily candle in the past maybe up to 5 days(customizable day) .


Code:
#Past 5 days reversal candle
def reversalcandle1 = (AbsValue(close - high ) > 6 * AbsValue ( open - close ) and AbsValue(close - open ) < .1 * AbsValue ( high - low ));
def reversalcandle2 = (AbsValue(close - low ) > 6 * AbsValue ( open - close ) and AbsValue(close - open ) < .1 * AbsValue ( high - low )) ;

input daysLookBack = 5;
plot scan = true(reversalcandle1 , daysLookBack);


look at my upper study, it uses sum() to check if a condition happened
https://usethinkscript.com/threads/problem-with-using-scan-and-fold.12917/#post-109706
 
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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