Scan close crosses the 50 SMA last 30 minutes


Category:
0
1

Hey Pete!  TOS is killing me with this one.

 

What I’m trying to do is find a stock where the close has passed the daily 50sma within 2 15 minute bars (intraday trading).

 

def dma = DailySMA(FundamentalType.CLOSE,AggregationPeriod.DAY,50,0);

plot scan;
scan = close crosses above dma within 2 bars ;

 

I can set this to 15min however TOS is telling me a Secondary Period is not allowed.

 

Thanks!

Marked as spam
Posted by (Questions: 10, Answers: 15)
Asked on June 16, 2020 2:21 pm
121 views
1
Private answer

Based on some followup questions listed in the comments section of my original answer I decided to produce the screenshot below to graphically demonstrate how any scan based on the daily time frame is able to produce results throughout the trading day.

I used the Condition Wizard to construct a basic scan based on the daily price crossing the daily 50 period simple moving average. Here is the code generated by the Condition Wizard:

close crosses above SimpleMovingAvg("length" = 50)."SMA"

I don't know of a more clear and concise way to describe this. You can be absolutely certain that if you run this particular scan on a daily time frame that will continue to produce real time results intraday. Any stocks crossing above it's 50 day simple moving average will appear in the results list while any stocks NOT crossing it's 50 day simple moving average will not appear in the results list.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4079)
Answered on June 17, 2020 7:05 pm
0
Thanks for the follow-up Pete! TOS is so confusing sometimes.
( at June 18, 2020 4:14 pm)
0
Private answer

Sorry, don't shoot the messenger. But there is no way around that limitation. "Secondary Period not allowed" is a solid block wall. There is no way to work around that in a custom scan. The only alternative is to remove the secondary aggregation period and run the scan using a daily time frame.

Marked as spam
Posted by (Questions: 37, Answers: 4079)
Answered on June 16, 2020 2:35 pm
0
Isn't that the purpose of the DMA? https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/C-D/DailySMA . Could I do close[1] < 50 and close> 50? Will that pop intraday?
( at June 16, 2020 3:07 pm)
0
DailySMA works on a chart study. Not for a scan. Yes, any scan constructed using the daily time frame can return results throughout the day. To test this, simply construct a scan that measures the range from the high of the day to the low of the day. Set the scan to return a list of stocks with range greater than ATR from previous day and watch as the scan results are updated throughout the day.
( at June 16, 2020 4:28 pm)
0
Does the crosses within 1 bar still work?
( at June 17, 2020 4:02 pm)