I am a newbie. I have found some awesome scans that I would like to add to my tos scans. However, some of the instructions from the authors of the scans say to "comment or uncomment" a line of the scan so I can change from searching for an up signal to looking for a down signal. I do not know how to do that. Here is and example
Ex:
# NOTE: ONLY ONE PLOT ALLOWED PER SCAN.
# Comment out the unwanted plot and Un-Comment the desired plot
@Kellyd Adding a hashtag # to the beginning of any line comments it out... Removing the hashtag makes the line of code active... For scans this would be a line starting with the word plot...
@Kellyd Adding a hashtag # to the beginning of any line comments it out... Removing the hashtag makes the line of code active... For scans this would be a line starting with the word plot...
Hi rad14733...and thank you for responding to my question. The question I asked is actually about one of your post about the Heikin Ashi scan for the indicator that you developed....which I think is awesome!!
Heikin_Ashi_Trend_Dots_Scan
# Finds potential trend reversals based on Heikin Ashi trend transition direction
That is the one that I do not know how to set up as two separate scans.... but with your help I think I have figured it out. Thank you so much!!
@Kellyd I'm glad you are finding the code useful... I will give a short review regarding scans...
Some scan code can actually be saved as a Study and then referenced from within the Stock/Option Scan Hacker... The scan code for Heikin_Ashi_Trend_Dots_Scan happens to be one of those... Other code does not cooperate when it comes to saving as a study and must be coded in its entirety within the Stock/Option Scan Hacker...
This scan, being fairly short compared to some, I chose to post the initial code for direct Copy & Paste into the scanner... Therefore, to switch from a scan for Longs to a scan for Shorts requires simple editing... The following plot lines are the ones that require the edits... I'll show both snippets here for clarity... Note the change of location of the hashtag between the Long and Short scans...
Long Trend Scan
Ruby:
# Long trend transition
plot long = haSignal[1] == 0 and haSignal == 1;
# Short trend transition
#plot short = haSignal[1] == 0 and haSignal == -1;
Short Trend Scan
Ruby:
# Long trend transition
#plot long = haSignal[1] == 0 and haSignal == 1;
# Short trend transition
plot short = haSignal[1] == 0 and haSignal == -1;
Now that we have that out of the way I'll cover saving the code as a Study and then referencing the Study from within a Scan... The code below should be saved using the name at the top of the script, minus the leading hashtag and blank space...
Ruby:
# Heikin_Ashi_Trend_Dots_Scan
# Finds potential trend reversals based on Heikin Ashi trend transition direction.
# Created by rad14733 for usethinkscript.com
# v1.0 : 2021-08-13 : Initial release
def haClose = ohlc4;
def haOpen = (haOpen[1] + haClose[1]) / 2;
def haTrendUp = if haClose >= haOpen then 1 else 0;
def haTrendDn = if haClose < haOpen then 1 else 0;
def haSignal =
if haTrendUp == 1 and haTrendUp[1] == 1 then 1
else if haTrendDn == 1 and haTrendDn[1] == 1 then -1
else 0
;
# NOTE: ONLY ONE PLOT ALLOWED PER SCAN.
# Comment out the unwanted plot and Un-Comment the desired plot
# Long trend transition
plot long = haSignal[1] == 0 and haSignal == 1;
# Short trend transition
plot short = haSignal[1] == 0 and haSignal == -1;
# END - Heikin_Ashi_Trend_Dots_Scan
As you can see, both plots are active which is not allowed directly within the scanner which only allows a single active plot per scan filter... But we can reference the Study and desired plot from within the Stock Scan Hacker, or even both if we create two separate scan filters - one for Longs and on for Shorts... Trust me, once you get the hang of the Scan Hackers it'll make sense...
The image below shows how you would reference the Study and select the Long plot for scanning...
The next image shows how you would reference the Study and select the Long plot for scanning...
And, finally, this last image shows how you can reference the Study to scan for both Long and Short triggers...
What you see above is two resulting scan conditions within a single filter, which works because we switch the default Check if all of the following conditions are met to any... This is how I scan because I want to see both Long and Short trend reversal signals that I then check on my chart...
Hopefully this makes some sense to you... If not, voice any further concerns and I'll do my best to help further... I probably covered a lot of ground in this post but if you play around you can't break anything by experimenting...
We will be merging the two topics related to this together and I have addressed this in the other topic... Custom Watchlist Column(s) will be coming soon...
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.
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.