declare upper;
input SMALength = 12;
input Displace = 3;
def FifteenMin_HL2 = HL2(period = AggregationPeriod.FIFTEEN_MIN);
def Day_CLOSE = close(period = AggregationPeriod.DAY);
def Day_SMA = SimpleMovingAvg(price = Day_Close, length = SMALength, displace = Displace);
plot enter = if FifteenMin_HL2 crosses above Day_SMA then LOW else double.nan;
plot exit = if FifteenMin_HL2 crosses below Day_SMA then HIGH else double.nan;
enter.SetPaintingStrategy(paintingStrategy = PaintingStrategy.ARROW_UP);
exit.setPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Displacement: The displacement of the SMA study, in bars. Positive values signify backward displacement.
declare upper;
input SMALength = 12;
input Displace = 3;
def FifteenMin_HL2 = HL2(AggregationPeriod=FIFTEEN_MIN);
def Day_CLOSE = CLOSE(AggregationPeriod=DAY);
def Day_SMA = SimpleMovingAvg(price = Day_Close, length = SMALength, displace = Displace);
plot enter = if FifteenMin_HL2 crosses above Day_SMA then LOW else double.nan;
plot exit = if FifteenMin_HL2 crosses below Day_SMA then HIGH else double.nan;
enter.setPaintingStrategy(PaintingStragegy.ARROW_UP);
exit.setPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
declare upper;
input SMALength = 12;
input Displace = 3;
def FifteenMin_HL2 = HL2(period = AggregationPeriod.FIFTEEN_MIN);
def Day_CLOSE = close(period = AggregationPeriod.DAY);
def Day_SMA = SimpleMovingAvg(price = Day_Close, length = SMALength, displace = Displace);
plot enter = if FifteenMin_HL2 crosses above Day_SMA then LOW else double.nan;
plot exit = if FifteenMin_HL2 crosses below Day_SMA then HIGH else double.nan;
enter.SetPaintingStrategy(paintingStrategy = PaintingStrategy.ARROW_UP);
exit.setPaintingStrategy(PaintingStrategy.ARROW_DOWN);
The ToS platform does not allow multiple timeframes to be used in the scan hacker, watchlists, conditional orders, etc...also btw, it doesnt like secondary period again.
"secondary period not allowed 15 min"
this is when I erase plot exit and exit painting strat code
Then how can I know when an sma is crossed by price within an intraday framework?The ToS platform does not allow multiple timeframes to be used in the scan hacker, watchlists, conditional orders, etc...
This code is only for plotting on a chart.
Not sure that I understand your question. The ToS platform does not provide the ability to scan for daily SMA crossed by 15 min price.Then how can I know when an sma is crossed by price within an intraday framework?
thanks
Then the only way would be to displace the 15 Min EMA to be synchronous with the Daily displacement, something like a -350 displacement on a 15 minute Globex chart. Problem is Id have to figure out the value for RTH stocksNot sure that I understand your question. The ToS platform does not provide the ability to scan for daily SMA crossed by 15 min price.
Multiple timeframes can not be used in scans, watchlists or conditional orders. Your script can only be plotted on a chart. If you leave the chart open, you could set up an alert.
https://usethinkscript.com/resources/how-to-add-alert-script-to-thinkorswim-indicators.9/
FYI: The scanner works fine as long as you are scanning for a 15 min SMA crossed by 15min price. Just use the built-in functions. No custom script is required.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
R | Todays low less than yesterday's low | Questions | 1 | |
![]() |
Show todays VWAP only | Questions | 3 | |
I | Bar count todays High Low | Questions | 9 | |
C | Stocks within 75% of Todays ATR range | Questions | 19 | |
N | How to get todays total volume in the scan with 15 min aggregation | Questions | 1 |
Start a new thread and receive assistance from our community.
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.
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.