Average Price Movements Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Uses daily average ranges of 5 and 10 (most used) as buy (support) and highs (resistance) areas.

7Cr1O01.png


EuDflTU.png


thinkScript Code

Code:
# Average Price Movements
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/eHhGyI6R-CD-Average-Daily-Range-Zones-highs-and-lows-of-the-day/

input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def dayrange = (high - low);

def r1 = dayrange[1];
def r2 = dayrange[2];
def r3 = dayrange[3];
def r4 = dayrange[4];
def r5 = dayrange[5];
def r6 = dayrange[6];
def r7 = dayrange[7];
def r8 = dayrange[8];
def r9 = dayrange[9];
def r10 = dayrange[10];

def adr_10 = (r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10) / 10;
def adr_5 = (r1 + r2 + r3 + r4 + r5) / 5;

def hl1 = (OPEN + (adr_10 / 2));
def ll1 = (OPEN - (adr_10 / 2));
def hl2 = (OPEN + (adr_5 / 2));
def ll2 = (OPEN - (adr_5 / 2));

plot upper2 = hl1;
plot lower1 = ll2;
plot upper1 = hl2;
plot lower2 = ll1;

addCloud(upper2, upper1, color.RED, color.RED);
addCloud(lower1, lower2, color.GREEN, color.GREEN);

upper1.SetDefaultColor(Color.dark_red);
upper2.SetDefaultColor(Color.dark_red);
lower1.SetDefaultColor(Color.dark_green);
lower2.SetDefaultColor(Color.dark_green);
 
Last edited:

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

Hi Ben:

I wanted to ask you if there is a scan available for this indicator? Would love something that can be configured to find stocks within a certain dollar amount from either the high (h1) or low (l1)of their average price move and alert the user for a potential upcoming trade. I used this while watching my favorite stock DIS for four successful early morning trades on 3/27, 3/30, yesterday and today.

Appreciate your thoughts and help.

Best,

Spriteman
 
@Spriteman You can use the crosses, crosses above, or crosses below as part of your scanner. There is no special configuration needed.
 
@Spriteman You can use the crosses, crosses above, or crosses below as part of your scanner. There is no special configuration needed.

@BenTen I was looking for a scan that could be configured to alert the user on a dollar amount or % prior to crossing h1 or l1 as a heads up to reaching either a resistence or support zone. do you think this is possible?
 
I've been using something similar after modding a @tomsk indicator. It has a wider range than the one posted but will sometimes provide reversal points if the price breaks out from the posted indicator.

@Topas if you change the agg period on this code to hourly or two hour it will sometimes provide signals similar to the volatility box. As you can see in the last image, sometimes the volatility indicators work, sometimes they don't.


Code:
# ATR Daily Range
# tomsk
# 12.17.2019

# V1.0 - 12.16.2019 - tomsk   - Initial release ATR Daily Range
# V1.1 - 12.16.2019 - tomsk   - Added performance relative to ATR range
# V1.2 - 12.17.2019 - tomsk   - Added plot lines for ATR High/Low on the chart

# Displays ATR High/Low thresholds relative to daily open

input length = 14;
input averageType = AverageType.WILDERS;

def o = open(period = AggregationPeriod.DAY);
def h = high(period = AggregationPeriod.DAY);
def l = low(period = AggregationPeriod.DAY);
def c = close(period = AggregationPeriod.DAY);
def R = (c - l) / (h - l);
def ATRD = MovingAverage(averageType, TrueRange(h, c, l), length);
def ATRH = o + ATRD;
def ATRL = o - ATRD;

AddLabel(1, "ATR Daily High/Low Level = [ " + Round(ATRH,2) + " / " + Round(ATRL,2) + " ]", Color.PINK);
AddLabel(1, "Current Close = " + close + " [ " + AsPercent(R) + " ]", Color.YELLOW);

def LBN = if isNaN(close[-1]) and !isNaN(close) then barnumber() else Double.NaN;
#plot ATR_High = if barNumber() >= highestAll(LBN)
#                then highestAll(if isNaN(close[-1]) then ATRH else Double.NaN)
#                else Double.NaN;
#ATR_High.SetLineWeight(2);
#ATR_High.SetDefaultColor(Color.Cyan);

#plot ATR_Low = if barNumber() >= highestAll(LBN)
#               then highestAll(if isNaN(close[-1]) then ATRL else Double.NaN) else Double.NaN;
#ATR_Low.SetLineWeight(2);
#ATR_Low.SetDefaultColor(Color.Yellow);

# End ATR Daily Range

##DeusMecanicus Mod
def ATRHH = o + (ATRD  * 1.1);
def ATRLL = o - (ATRD  * 1.1);

plot ATR_High = ATRH;
ATR_High.SetLineWeight(2);
ATR_High.SetDefaultColor(Color.CYAN);

plot ATR_Low = ATRL;
ATR_Low.SetLineWeight(2);
ATR_Low.SetDefaultColor(Color.MAGENTA);

plot ATR_High1 = ATRHH;
ATR_High.SetLineWeight(2);
ATR_High.SetDefaultColor(Color.CYAN);

plot ATR_Low1 = ATRLL;
ATR_Low.SetLineWeight(2);
ATR_Low.SetDefaultColor(Color.MAGENTA);
AddCloud(ATR_High, ATR_High1, Color.CYAN, Color.CYAN, yes);
AddCloud(ATR_Low, ATR_Low1, Color.MAGENTA, Color.MAGENTA, yes);


input showBreakoutSignals = yes;
plot DownSignal = high crosses above ATR_High;
plot UpSignal = low crosses below ATR_Low;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

Alert(UpSignal, "Buy", Alert.Bar, Sound.Chimes);
Alert(DownSignal, "Sell", Alert.bar, Sound.Chimes);
 
@K_O_Trader Oh I see. Unfortunately, ToS doesn't allow their scanner to work with this sort of indicator because it uses higher aggregation period.
 
@Playstation @fjr1300 thanks for sharing this avg price mov script.

So, I have downloaded and applied post #15 by playstation on 10D 1h chart on my flex grid. It gives red and green resistance and support levels for each day. Cool. Second, it gives red & green bubbles, red for resistance with a price and green for support with price. Great!

Now, jumping to @fjr1300 post #23 - What needs to be added in the script to get:
A. Labels: green/red/yellow
AND
B. Bubbles sell confirmed, buy confirmed that's shown in the picture of #23.

I added @Playstation post #22
"AddLabel(yes, if ohlc4 > TrailingStop then "BULLISH SWINGARM" else "BEARISH SWINGARM", if ohlc4 > TrailingStop then Color.GREEN else Color.Red);"

However, after adding to script post #15, it gave red background over "trailingstop"

I am not a coder, any help would be beneficial. Thanks again

Edit ----

After reading blagflag thread, I realized that addLabel that @Playstation had posted was for swingarm script & not for avg pr mov. I have added the above label and I am getting label bullish swingarm. Next Q is @fjr1300 can you please advise what script needs to be modified to have sell/buy confirmed bubbles as well.

I am using @Playstation post 15 script along with blackflag script post 1 in your thread - and - hull ma con turning pts. Any help would be great. Using this on 1d 10m chart.
 
Last edited:
@mansor Hi. This is how I use it for day trading:

This is one way to use the SwingArms for Day Trading:
MONITOR #1 1 Minute Grid https://tos.mx/lM0nCpx MONITOR #2 5 Minute Grid 2 Charts basic view and Trend Momentum View https://tos.mx/J6DFRbk

blackFLAG FTS SwingArm 1 Minute Grid

blackFLAG SwingArm - 5 Minute Grid

Trade in the direction of the 5 Minute when the One Minute setups and agrees to move in the same direction. High probability, low risk, high reward.

Recognizing that the 1 min may cycle as the trade develops. Option one, close trade as the 1 min breaks down or ride it and keep stop below the 5 min. swingarm.

Stay in the trade as long as the 5 min is bullish.

or vice versa with an awareness of higher timeframe swingarm locations to know if you are getting too close to support or resistance zones
 
Thank you for sharing this great indicator! Is it possible to make a scan version for the support and resistance?
 
Quick modification to the indicator requested by @dvorakm with the ability to show only current day's zones.

Code:
# Average Price Movements
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/eHhGyI6R-CD-Average-Daily-Range-Zones-highs-and-lows-of-the-day/

input ShowTodayOnly = yes;
def Today = if GetDay() == GetLastDay() then 1 else 0;

input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def dayrange = (high - low);

def r1 = dayrange[1];
def r2 = dayrange[2];
def r3 = dayrange[3];
def r4 = dayrange[4];
def r5 = dayrange[5];
def r6 = dayrange[6];
def r7 = dayrange[7];
def r8 = dayrange[8];
def r9 = dayrange[9];
def r10 = dayrange[10];

def adr_10 = (r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10) / 10;
def adr_5 = (r1 + r2 + r3 + r4 + r5) / 5;

def hl1 = (OPEN + (adr_10 / 2));
def ll1 = (OPEN - (adr_10 / 2));
def hl2 = (OPEN + (adr_5 / 2));
def ll2 = (OPEN - (adr_5 / 2));

plot upper2 = if ShowTodayOnly and !Today then Double.NaN else hl1;
plot lower1 = if ShowTodayOnly and !Today then Double.NaN else ll2;
plot upper1 = if ShowTodayOnly and !Today then Double.NaN else hl2;
plot lower2 = if ShowTodayOnly and !Today then Double.NaN else ll1;

addCloud(if ShowTodayOnly == yes then upper2 else double.nan, upper1,color.red, color.red);
addCloud(if ShowTodayOnly == yes then lower1 else double.nan, lower2,color.green, color.green);

upper1.SetDefaultColor(Color.dark_red);
upper2.SetDefaultColor(Color.dark_red);
lower1.SetDefaultColor(Color.dark_green);
lower2.SetDefaultColor(Color.dark_green);
 
I have notice that the support and resistance levels do not show during pre market, after market starts the lines appear. Does anyone know if this is fixable? Thanks.
 
@GGC This indicator does not take into account pre-market hours. If you want to see the projection for next day's support and resistance area, then turn off extended hours.
 
Hi Ben! Do you have an Average Price Movement indicator that works on Mobile? (I think it needs to get rid of the MTF capability)
@GGC This indicator does not take into account pre-market hours. If you want to see the projection for next day's support and resistance area, then turn off extended hours.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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