Scan Using Future Bars & Highest All

chewie76

Well-known member
VIP
VIP Enthusiast
I tried scanning for when the histogram is blue, like highlighted in the below picture. I created a plot for this called "blue". For some reason, the results are not working at all. What am I doing wrong?

Scan
http://tos.mx/!UInj9Whd

Indicator
http://tos.mx/!eQfxYyXo

1765943613609.png
 
Solution
I tried scanning for when the histogram is blue, like highlighted in the below picture. I created a plot for this called "blue". For some reason, the results are not working at all. What am I doing wrong?


I don't use future bars or the deprecated HighestAll() function
def isLastBar = IsNaN(regAvg[-1]) and !IsNaN(regAvg);
def regCapture = if isLastBar then regAvg else Double.NaN;
def regFlat = HighestAll(regCapture);

I am just assuming that is where the problem lies.
Here are the issues:
Use of future bars means that the trigger is not painted on the current bar but repainted further back.
Therefore, adding within x bars with allow the scan to find results.

The bigger issue is the Highest All dependency makes the...
I tried scanning for when the histogram is blue, like highlighted in the below picture. I created a plot for this called "blue". For some reason, the results are not working at all. What am I doing wrong?


I don't use future bars or the deprecated HighestAll() function
def isLastBar = IsNaN(regAvg[-1]) and !IsNaN(regAvg);
def regCapture = if isLastBar then regAvg else Double.NaN;
def regFlat = HighestAll(regCapture);

I am just assuming that is where the problem lies.
Here are the issues:
Use of future bars means that the trigger is not painted on the current bar but repainted further back.
Therefore, adding within x bars with allow the scan to find results.

The bigger issue is the Highest All dependency makes the level inconsistent across scans/charts/watchlists because it always references the absolute last bar of the entire dataset, not a fixed lookback for scan, watchlists, or charts;
Given that the dataset available on your chart will never match the dataset in the scan; it will always result in inconsistencies. Additionally, Schwab deprecated the HighestAll() function resulting in it; not updating in real time.
Here is my workaround:
https://usethinkscript.com/threads/premarket-charts-analysis-followup.21879/page-3#post-158874


9hFckup.png

Here is the code resolving the forward looking bars BUT THE ISSUE with HighestALL errors remain.
Ruby:
#Williams_Vix_Fix_BollingerBand

input pd = 22;                     # Period for Highest Close
input length = 20;                 # SMA Length
def highestClose = Highest(close, pd);
def WVF = (highestClose - low) / highestClose * 100;

input buyline = 2.0;
input lookback = 400;

def regApprox = Inertia(WVF, length);
def regAvg = if BarNumber() > lookback
                then Average(regApprox, lookback)
                else regApprox;

def isLastBar = IsNaN(regAvg[-1]) and !IsNaN(regAvg);
def regCapture = if isLastBar then regAvg else Double.NaN;
def regFlat = HighestAll(regCapture);
def PercentLineUP = regFlat * buyline;



def blue = WVF > PercentLineUP and WVF < WVF[1] ;

plot scan = blue within 3 bars;
 
Solution
It's working fine on my end... it might be the volume filter if you were working on it after hours. Daily volume resets back to zero at some point, not sure when exactly, but that filter will deny results if you have a minimum after the reset. Just a theory for now anyway, won't know for sure until later tonight.
 
I don't use future bars or the deprecated HighestAll() function


I am just assuming that is where the problem lies.
Here are the issues:
Use of future bars means that the trigger is not painted on the current bar but repainted further back.
Therefore, adding within x bars with allow the scan to find results.

The bigger issue is the Highest All dependency makes the level inconsistent across scans/charts/watchlists because it always references the absolute last bar of the entire dataset, not a fixed lookback for scan, watchlists, or charts;
Given that the dataset available on your chart will never match the dataset in the scan; it will always result in inconsistencies. Additionally, Schwab deprecated the HighestAll() function resulting in it; not updating in real time.
Here is my workaround:
https://usethinkscript.com/threads/premarket-charts-analysis-followup.21879/page-3#post-158874


9hFckup.png

Here is the code resolving the forward looking bars BUT THE ISSUE with HighestALL errors remain.
Ruby:
#Williams_Vix_Fix_BollingerBand

input pd = 22;                     # Period for Highest Close
input length = 20;                 # SMA Length
def highestClose = Highest(close, pd);
def WVF = (highestClose - low) / highestClose * 100;

input buyline = 2.0;
input lookback = 400;

def regApprox = Inertia(WVF, length);
def regAvg = if BarNumber() > lookback
                then Average(regApprox, lookback)
                else regApprox;

def isLastBar = IsNaN(regAvg[-1]) and !IsNaN(regAvg);
def regCapture = if isLastBar then regAvg else Double.NaN;
def regFlat = HighestAll(regCapture);
def PercentLineUP = regFlat * buyline;



def blue = WVF > PercentLineUP and WVF < WVF[1] ;

plot scan = blue within 3 bars;
I appreciate your efforts. From what I'm showing as results, it doesn't look like it's capable. Thanks for checking.
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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