NexusFi: Find Your Edge


Home Menu

 





Plot an ATR line above & below the recent candle


Discussion in ThinkOrSwim

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




 
Search this Thread

Plot an ATR line above & below the recent candle

  #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?
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts