NexusFi: Find Your Edge


Home Menu

 





Plot an ATR line above & below the recent candle


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,461 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
Rustic
Bucharest
 
Posts: 26 since Mar 2020
Thanks Given: 9
Thanks Received: 15

Hello,
I have this TOS study that plots lines on the chart showing the ATR distance above & below the close.
Is there a way to have it plot these line only for the last candle?
Alternatively, can I have the values shown on the price axes as normal bubbles without plotting the indicator on the chart?

Thank you

ThinkScript code:

def len = 2;

input length = 14;
input ShowATR = No;
def ATR = Average(TrueRange(high(period = “DAY”), close(period = “DAY”), low(period = “DAY”)), length )[1];

def dayHigh = DailyHighLow(AggregationPeriod.DAY, len, 0, no).dailyhigh;
def dayLow = DailyHighLow(AggregationPeriod.DAY, len, 0, no).DailyLow;
def price = close;

def ADR_high = price + ATR;
def ADR_low = price - ATR;

plot ADR_H = ADR_high;
plot ADR_L = ADR_low;


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The Backwardation Signal: How the CL Futures Curve Tells …
Commodities
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Prediction Markets Expiry Day: Trump Eyes War Exit, $230 …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
 JayC 
San Diego, CA
 
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 55 since Mar 2019
Thanks Given: 9
Thanks Received: 43

Try something like this...

 
Code
def LastBar = !IsNaN(open) and IsNaN(open[-1]);

plot ADR_H = if LastBar then ADR_high else Double.NaN;
plot ADR_L = if LastBar then ADR_low else Double.NaN;


Reply With Quote
Thanked by:
  #3 (permalink)
Rustic
Bucharest
 
Posts: 26 since Mar 2020
Thanks Given: 9
Thanks Received: 15


Yes that does the job, great


Reply With Quote




Last Updated on February 28, 2021


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts