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

Convert an OTA indicator from TS to ToS

Discussion in ThinkOrSwim

Updated by speigo
    1. trending_up 503 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 replies
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 100,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)

Thread Tools Search this Thread

Convert an OTA indicator from TS to ToS

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

Convert an OTA indicator from TS to ToS

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;

Last edited by speigo; May 25th, 2019 at 02:21 PM.
Reply With Quote

Can you help answer these questions
from other members on futures io?
Convert NinjaTrader NT7 indicator to Tradestation EasyLanguage and RADARSCREEN
Platforms and Indicators
Issue meeting order entry conditions
Elite Automated NinjaTrader Trading
Last 5 minutes Label
Moving average with Lag reduction
  #2 (permalink)
Seattle, WA/USA
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 76 since Sep 2016
Thanks: 7 given, 26 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:
  #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

Upcoming Webinars and Events

Understanding Order Flow Stop Runs & Icebergs w/Bookmap

May 28

Free BloodHound Licenses to everyone!


Copyright © 2020 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