Scanner to paint signals only after market closed

8Nick8

Active member
2019 Donor
VIP
Hi, I need some assistance with this indicator script and the scanner that i am trying to create. To set the context, i am trading on Daily Timeframe and i will use this script to find trade signals after market close to prepare the next day trade. So, any Signals painted during market hours are not tradable yet.

I have created a scanner with the script and it is able to scan out stocks that met the criteria "is True within 2 Bars" and displayed in the dynamic watchlist. As such, it will scan SIGNALs for Current Day and Yesterday to be appeared in the watchlist

The questions i have are

1. Is there a way that the dynamic watchlist DO NOT update the CURRENT day signals and only UPDATE it after market closed?

2. Or Is there a way that the CURRENT day SIGNALS can only be painted after Market has closed.

Thank you

Code:
##############################################################################
# Plot EMA Trends

plot Trend1 = MovAvgExponential(close, 20);
Trend1.AssignValueColor(if close > Trend1 then Color.GREEN else Color.RED);

plot Trend2 = MovAvgExponential(close, 40);
Trend2.AssignValueColor(if close > Trend2 then Color.GREEN else Color.RED);

def Price2MA = MovAvgExponential(close, 10);
def condition1 = close > Price2MA;

input length = 14;
input over_sold = -100;
input over_bought = 100;
def price = close + low + high;
def linDev = LinDev(price, length);
def CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
def ZeroLine = 0;
def condition2 = CCI crosses above ZeroLine;

plot Signal1 = condition1 and condition2 and Trend1 > Trend2;
Signal1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Signal1.SetLineWeight(3);
Signal1.AssignValueColor(Color.MAGENTA);

#End

The last signal arrow was painted when the market is still open.

nFBEbpU.jpg
 

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

@Nick I think @BenTen's method would probably work best... The only alternative would be to use a time constraint as part of your criteria that would exclude the currently active trading session... And if something shows up today of course it will also show up tomorrow so why the delay...???
 
@rad14733 thanks for your response. May i know how can i add the time constraints to exclude currently active session? Oh, i missed to explain this part, that one of the rules i have for trade entry is to have a GREEN EMA following a valid signal. That's why i only focus on the previous day signal.

Thanks
 
Be sure to include extended hours on your scan and the proper time aggregation.

Code:
def Trend1 = MovAvgExponential(close, 20);
def Trend2 = MovAvgExponential(close, 40);
def Price2MA = MovAvgExponential(close, 10);
def condition1 = close > Price2MA;
def length = 14;
def over_sold = -100;
def over_bought = 100;
def price = close + low + high;
def linDev = LinDev(price, length);
def CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
def ZeroLine = 0;
def condition2 = CCI crosses above ZeroLine;
def Signal1 = condition1 and condition2 and Trend1 > Trend2;
def Signal1_Aftermarket= if getday()==getlastDay() and secondsfromTime(1200)>0 and secondsFromTime(1600)<0  then Signal1 else Signal1_Aftermarket[1];

plot scan = Signal1_Aftermarket;
 
Be sure to include extended hours on your scan and the proper time aggregation.

Code:
def Trend1 = MovAvgExponential(close, 20);
def Trend2 = MovAvgExponential(close, 40);
def Price2MA = MovAvgExponential(close, 10);
def condition1 = close > Price2MA;
def length = 14;
def over_sold = -100;
def over_bought = 100;
def price = close + low + high;
def linDev = LinDev(price, length);
def CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
def ZeroLine = 0;
def condition2 = CCI crosses above ZeroLine;
def Signal1 = condition1 and condition2 and Trend1 > Trend2;
def Signal1_Aftermarket= if getday()==getlastDay() and secondsfromTime(1200)>0 and secondsFromTime(1600)<0  then Signal1 else Signal1_Aftermarket[1];

plot scan = Signal1_Aftermarket;

@XeoNoX I have followed your instruction to include the extended hours and time aggregation in my scan, can i confirm if this is correct?
Thanks
Scanner setup
 
i beleive all you have to do is attemt to apply the code and then see if it works. :ROFLMAO:
Yes, i did produce some scan results but the results didn't meet the Signal1 conditions... 😅 😅
Secondly, I am not sure what is the right time aggregation to set and it's significance?
Hope to get some advices on this..thanks
 
Yes, i did produce some scan results but the results didn't meet the Signal1 conditions... 😅 😅
Secondly, I am not sure what is the right time aggregation to set and it's significance?
Hope to get some advices on this..thanks
can you post screenshots of the way you are setting up the scanner and custom scan study and the results that you say arent meeting condition1?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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