Convert an OTA indicator from TS to ToS - futures io
futures io

Convert an OTA indicator from TS to ToS

Discussion in ThinkOrSwim

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

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Convert an OTA indicator from TS to ToS

(login for full post details)
  #1 (permalink)
Huntington Beach, CA, USA
Posts: 3 since May 2019
Thanks: 1 given, 0 received

I have looked at the available ToS downloads and some of the threads regarding converting scripts from one platform to another. I also looked in the Online Trading Academy (OTA) posts but didn't see anything there.

I would like to convert the floating ATR capability that is a download from OTA. If anyone can help that would be great. Here is the code and the picture of what it looks like in TradeStation. Thanks in advance.

****** OTA Floating ATR
****** This tool displays the Daily ATR on the chart as well as 10% and 2% of the Daily ATR.

****** Easy Language Code
inputs: PosX( 40 ), PosY( 97 ), TextColor( Black );

var: tsdata.marketdata.PriceSeriesProvider dPSP( NULL );
method override void InitializeComponent() begin
dPSP = new tsdata.marketdata.PriceSeriesProvider;
dPSP.Symbol = GetSymbolName;
dPSP.Interval.ChartType = tsdata.marketdata.DataChartType.Bars;
dPSP.Interval.IntervalType = tsdata.marketdata.DataIntervalType.Daily;
dPSP.Interval.IntervalSpan = 1;
dPSP.Interval.Name = "(Unknown name)";
dPSP.Range.Type = tsdata.marketdata.DataRangeType.Months;
dPSP.Range.Months = 2;
dPSP.Range.Name = "(Unknown name)";
dPSP.IncludeVolumeInfo = false;
dPSP.IncludeTicksInfo = false;
//dPSP.UseNaturalHours = false;
dPSP.Realtime = true;
//dPSP.TimeZone =;
dPSP.Load = true;
dPSP.Name = "dPSP";

vars: IntrabarPersist FirstTickOfBar( False ),
x( 0 ), ATR( 0 ), HalfATR( 0 ), QuarterATR( 0 ), TenthATR( 0 ), TwoPctATR( 0 ), ATRText( 0 ), Dec( 0 ), Add( 0 );

ATR = 0;
for x = 0 to 13 begin
if dPSP.Count > 14 then
ATR = ATR + ( iff(dPSP.Close[x+1] astype double > dPSP.High[x] astype double, dPSP.Close[x+1] astype double, dPSP.High[x] astype double)
- iff(dPSP.Close[x+1] astype double < dPSP.Low[x] astype double, dPSP.Close[x+1] astype double, dPSP.Low[x] astype double) );
ATR = ATR / 14;

if Category = 2 then Dec = 2
else if Category = 12 then begin if MidStr(Symbol, 4, 3) = "JPY" then ATR = ATR * 100 else ATR = ATR * 10000; Dec = 0; end
else if Category = 0 then
if SymbolRoot="EC" OR SymbolRoot="JY" OR SymbolRoot="BP" OR SymbolRoot="AD" OR SymbolRoot="CD" OR SymbolRoot="SF" then begin ATR = ATR * 10000; Dec = 0; end
else Dec = 3;
if Dec = 0 then Add = 1 else Add = MinMove * 0.01;
HalfATR = (Round((ATR*0.5/Add),0)+1) * Add; QuarterATR = (Round((ATR*0.25/Add),0)+1) * Add; TenthATR = (Round((ATR*0.1/Add),0)+1) * Add; TwoPctATR = (Round((ATR*0.02/Add),0)+1) * Add;

if ATRText <> 0 AND FirstTickOfBar then Value1 = Text_Delete( ATRText );
ATRText = Text_New( Date, Time, Close, "[dATR]:"+NumToStr(ATR,Dec)+" [10%]:"+NumToStr(TenthATR,Dec)+" [2%]:"+NumToStr(TwoPctATR,Dec) );
Value1 = Text_SetColor( ATRText, TextColor ); Value1 = Text_Float( ATRText, PosX, PosY );

FirstTickOfBar = BarStatus(1) = 2;

Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(96 thanks from 15 posts)
looks_twoSalao's Journalby Salao
(32 thanks from 7 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(26 thanks from 10 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(13 thanks from 8 posts)
looks_5Maybe a little bit different journalby Malykubo
(9 thanks from 8 posts)
Best Threads (Most Thanked)
in the last 7 days on futures io
Would You Sell Your System?
71 thanks
The Crude Dude Oil Trading System
39 thanks
Big Mike in Ecuador
36 thanks
futures io site changelog and issues/problem reporting
24 thanks
The New Micro Contract - MICRO BITCOIN coming May 2021
23 thanks
(login for full post details)
  #2 (permalink)
Seattle, WA/USA
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 90 since Sep 2016
Thanks: 7 given, 32 received

There are some ATR labels available for free on the interwebs that might do the trick. No screenshot, so not sure if this will work for ya, but try this one:

input ATRLength = 14;
def ATR = Round(AvgTrueRange(high, close, low, ATRLength), 2);
def ATR10 = ATR * .1;
def ATR02 = ATR * .02;
addLabel(yes,concat(“ATR=”, ATR), color.Yellow);
addLabel(yes,concat(” ATR10=”, ATR10), color.White);
addLabel(yes,concat(” ATR02=”, ATR02), color.Green);

Follow me on Twitter Reply With Quote
The following user says Thank You to kjhosken for this post:
(login for full post details)
  #3 (permalink)
Huntington Beach, CA, USA
Posts: 3 since May 2019
Thanks: 1 given, 0 received

Thank you for the response. I will give this code a try.

Reply With Quote

futures io Trading Community Platforms and Indicators ThinkOrSwim > Convert an OTA indicator from TS to ToS

Last Updated on June 14, 2019

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Journal Challenge w/$1,800 in prizes!


Seven Trading Mistakes Solved With Smart Trading Tools w/Brannigan Barrett

Elite only

Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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.
no new posts