Stacked Moving Averages

petech

Member
VIP
I don't know how to code. I'm doing my best to figure it out. I'll keep clicking around TOS to see if I can figure it out from reading everyone's responses.
 

XeoNoX

Well-known member
VIP
you dont need to know ho to code, you just search for the code on the forums, find it, plug in your 2 moving averages and then add it to the tos scan. then repeat for the rest of the MAs
 

petech

Member
VIP
@Xeono

I'm still looking...so far I found this page

https://usethinkscript.com/threads/scanner-to-find-distance-between-price-and-moving-average.699/

The code on there doesn't work like I'm expecting it to.

@MerryDay, thanks for the link. I'm about to try it out now. I did do some google search before I came to post. I didn't see what I was looking for. Or perhaps I used inadequate search terms. I didn't even know what a conditional wizard was an hour ago. There is a big knowledge gap on my end.
 

petech

Member
VIP
@petech Posters to this forum aren't expected to be coders. However, in order to be a successful trader, it is important to be able to do your own research. One of the most important components of research is the ability to search the internet and this forum for the answers you need.

So when you searched this forum, did you attempt to change the simple moving averages in the below link to your lengths and run your scan? If so what issues did you have? Continue to provide screenshots, as you have, as you ask questions. A picture is worth a 1000 words
https://usethinkscript.com/threads/bullish-stack-smas-scan.3655/#post-53895
HTH
I just copied and pasted the script you linked to into TOS and ran the scanner. There were 2697 results. One of them was AZFL, which was also picked up by the other code form the other page I linked in the last message. On the daily chart for today, the candle is no where near the 9/20/50 MA.
 

petech

Member
VIP
#Price is within X% max of the 20 SMA #### Change percentvalue to percent % in decimal format ### Example .02 is 2% and .025 is 2.5% def percentvalue = .01; #Price is with X of X EMA def ma = simpleMovingAvg(close,20); def s3 = ma*percentvalue; plot scan = absvalue(close - ma) is less than or equal to s3;
I found this one, this seems promising, now just need to figure out how to edit it.
 

petech

Member
VIP
@petech The script needs to be saved as a custom study, then you can edit it and then run a scan.
Most scripts are NOT pasted directly in the scanner.
Google the internet for " thinkorswim scan custom study " to understand the scan hacker screen.

Yes I know how to save the code into the scanner and run it. I've done that part already. That is how I know that code does correctly scan for price close to the 20MA. I've looked at the code for quite a few minutes, but I don't know how to add to it. I have some high school level coding, from many years ago. So I do know what a variable is, so I do understand what I am looking at. But that is the extent of my understanding. I would know how to change the 20MA to a 50MA, but I wouldn't know how to get it to also scan for all the other MA in combination
 

petech

Member
VIP
Okay, I've got it to work by stacking multiple versions of that code to run in combination. Thanks for helping me everyone.
 
Last edited:

petech

Member
VIP
Also is there a way to limit the scan I've setup to either a singular stock or a small hand full of stocks that I hand pick? I would like to setup an alert for when those conditions are met intra day. I've already done a google search. Can't find it. Please let me know what phrase I should type in search to go look for it again. Thank you in advance.
 

petech

Member
VIP
@petech Really? There was just a thread posted in the last hour on how to scan for a single stock and you didn't see it when you searched the forum? WTF? Doing your own research was the point of this thread. You need to do the searches and then ask the question. Trying different terms in your searches is a learning process. Googling is a learned process. You need to do the work I am done.
I just went straight to google search. Apologies for missing it. There is a lot of things about thinkorswim that I don't know how to do. Before today I didn't know what a conditional wizard was. I didn't even know how to create a watchlist. I google it just now after look at your post on how to create an alert for a single stock. It wasn't an unwillingness to try or do it myself, it is more that I don't know what I don't know. I also find looking at other people's lengthy code very intimidating. Looking at code is something I almost never do.

It wasn't my intent to be difficult. I've found the entire process very overwhelming.
 
Last edited:

treymolnar

New member
Can anyone help me create a scan for stocks that are trading above the VWAP, 21 & 8 day ema? I've been trying to tinker around with the scan section but I can't seem to figure this one out. Thanks in advance.
 

rad14733

Well-known member
VIP
Can anyone help me create a scan for stocks that are trading above the VWAP, 21 & 8 day ema? I've been trying to tinker around with the scan section but I can't seem to figure this one out. Thanks in advance.
Should be fairly simple to scan for close crosses above vwap and close crosses above ExpAverage(close, 21) and close crosses above ExpAverage(close, 8)... OR close > vwap and close > ExpAverage(close, 21) and close > ExpAverage(close, 8)... 💡

Pick whichever best suits your needs... You can also add within x bars to each condition...
 

treymolnar

New member
Should be fairly simple to scan for close crosses above vwap and close crosses above ExpAverage(close, 21) and close crosses above ExpAverage(close, 8)... OR close > vwap and close > ExpAverage(close, 21) and close > ExpAverage(close, 8)... 💡

Pick whichever best suits your needs... You can also add within x bars to each condition...
Thank you
 

DrSalsero

New member
Dear experts … I am seeking your valued advise in writing a script which (a) scans a designated watch-list, (b) provides a symbol (e.g. arrow-up) on the chart, and (c) alerts when the following criteria is triggered: mark price is higher than (i) EMA 20, (ii) EMA 200, and (iii) VWAP. Thanks for your support in advance.
 

MerryDay

Administrative
Staff member
Staff
VIP
@rad14733 Is mark one of the price options in the scanner? I didn't see it.
@DrSalsero Here is the scan as you requested it. Except, this uses the close of the candle because I don't believe Mark is supported in the TOS scanner. This scan returns so many results. What do you use it for? Before you come back with more questions, play w/ the aggregations, also click on the pencil next to each filter, and look at what is available for scanning. Feel free to play w/ it. It won't break.
To get an idea of how to further modify your scan, google youtube for setting up thinkorswim scans. No coding experience required. HTH

Here is the shared link: http://tos.mx/QgrA2Fg
egJ3PCi.png
 

DrSalsero

New member
Thanks @MerryDay ... with your post I figured out the settings for the scan (close is greater than MovAvgExponential("length" = 200)."AvgExp" etc.); this works fine. INTENDED USE: I intend to scan a specified watchlist to alert an entry point for a bid. I am working on a code , but still need to solve few aspects:

Code:
#PRICE >> EMA20 AND PRICE >> EMA200 AND PRICE >> VWAP

#not solved yet: need to define a watchlist for scan

input price = close;
input length_short = 9;
input length_mid = 20;
input length_long = 200;

def EMA_m = MovAvgExponential(price, length_mid);
def EMA_l = MovAvgExponential(price, length_long);
def VWAP_ = VWAP();

def buynow  = price > EMA_m and price > EMA_l and price > VWAP_;

plot a = buynow; #needs to show an arrow on chart

a.AssignValueColor(Color.GREEN);

#not solved yet: needs alert
 

s1111

Active member
@rad14733 Just a comment regarding MACD info, the code sent was how it appeared in my collection. I fiddle with pieces, but never with titles.
Included is MA_Cloud,. https://tos.mx/dPHW9IK
MA_Crossover-w-clouds https://tos.mx/DfjXMQC
SLM code,.. https://tos.mx/Vei7CId
Thank you so much for this script . I used your ma crossober with clouds . Clean chart and great script . I removed ma short bubble display that hovers around the candles but other than that its tits :). Before I was using 9/15ema and 45 ema for conformation on a 1 min chart . Here is my chart setup, any suggestions will be appriciated. Hope someone finds this setup useful .
https://tos.mx/blUIgeo

One quick question @Thomas , when bubble popps up with C and the price , what does C stand for ? green C with price is Buy and red C with price a sell . Seen red arrow down a few times today but never got green arrow when it was bullish .
 

XeoNoX

Well-known member
VIP
Also is there a way to limit the scan I've setup to either a singular stock or a small hand full of stocks that I hand pick? I would like to setup an alert for when those conditions are met intra day. I've already done a google search. Can't find it. Please let me know what phrase I should type in search to go look for it again. Thank you in advance.
create a watchlist, add the stock or stock(s) you want to scan against. Go to the stockhacker and where it says "scan in" change it to the name of your watchlist

https://tlc.thinkorswim.com/center/howToTos/thinkManual/Scan/Stock-Hacker


SH_exclude.2020-01-30-09-48-42.png
 

Similar threads

Top