ThinkScript (TOS) Programming Question - ThinkOrSwim Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming

ThinkScript (TOS) Programming Question
Started:August 1st, 2010 (01:46 PM) by Curbfeeler Views / Replies:6,199 / 10
Last Reply:March 8th, 2016 (03:19 PM) Attachments:1

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

ThinkScript (TOS) Programming Question

Old August 1st, 2010, 01:46 PM   #1 (permalink)
Elite Member
Des Moines, IA
Futures Experience: Beginner
Platform: NinjaTrader
Posts: 22 since Nov 2009
Thanks: 33 given, 16 received

ThinkScript (TOS) Programming Question

Hi. I have a question about Thinkscript. I am not optimistic that anyone can help me, because I don't think what I want to do is possible. My strategy is a kind of swing method. I have a condition (unimportant at this point, to go into detail), and then this condition is met I want to draw two horizontal lines above and below the signal bar. I want these lines to continue until price breaks either line. I want to ignore additional signals while this signal is still in play (see picture).

Here is the problem...

When I create the "HighLine" I need to look back and see what "HighLine[1]" was (last bar compared to price). That's easy enough, but I also need to take a peek at "LowLine[1]."

The problem is this hasn't been defined in my code yet, so I can't reference it. Thinkscript does not give you any way to define a variable at the top of the code and then change it towards the bottom of the code. So for instance, if I could drop myself a little breadcrumb in ThinkScript and tell myself that the two lines had been 30 ticks apart, I'd be fine--so long as I could reference this at the top of my code later.

Maybe I am missing something. Is there anybody who has figured out a way to do something similar?

Any help is appreciated. I have a feeling I may need to draw two dots and fill the lines in manually. What a drag that will be, since I could code this whole strategy in NT is less than an hour.

Attached Thumbnails
ThinkScript (TOS) Programming Question-tos_strategy.png  
Reply With Quote

Old August 1st, 2010, 01:46 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old August 21st, 2010, 02:24 PM   #3 (permalink)
Elite Member
new york, ny
Futures Experience: Beginner
Platform: Velocity, Sierracharts, TOS
Broker/Data: Velocity/TT FIX
Favorite Futures: 6E
Posts: 21 since Aug 2010
Thanks: 14 given, 5 received

I do not know if you are familiar with ....

these sites but here goes.

you should also check the forum on

good luck,

Reply With Quote
The following 2 users say Thank You to oztrd for this post:

Old January 27th, 2011, 09:58 PM   #4 (permalink)
Elite Member
Orlando, FL
Futures Experience: Advanced
Platform: NinjaTrader, ToS, Sierra Chart, MCDT
Broker/Data: Interactive Brokers
Favorite Futures: ES, NQ, 6E, 6A, TF, CL
kojava's Avatar
Posts: 43 since Jan 2011
Thanks: 51 given, 28 received

Thanks for those links. They are very helpful.


you should also check the forum on

good luck,

Reply With Quote

Old February 23rd, 2011, 09:12 PM   #5 (permalink)
Elite Member
Glyndon, Maryland, USA
Futures Experience: Advanced
Platform: TOS
Favorite Futures: options
Posts: 24 since Sep 2010
Thanks: 6 given, 46 received

Futures Edge on FIO

How much money do you need to trade futures successfully?

If you expain in more detail, preferrably in English I am happy to help you figure it out.

Reply With Quote

Old July 24th, 2011, 09:04 AM   #6 (permalink)
Futures Experience: Intermediate
Platform: NT, IB
Broker/Data: IB
Favorite Futures: Currency Futures
sam1197's Avatar
Posts: 55 since Feb 2011
Thanks: 13 given, 11 received

Help with TOS Pivots

optntdr13 View Post
If you expain in more detail, preferrably in English I am happy to help you figure it out.

Can I use your talent in modifying/writing TOS Pivot points to plot mid points? Thanks in advance.

Pivot Point

example" M1 = (S1 + S2)/2

Thanks in advance.

Reply With Quote

Old November 7th, 2011, 02:18 PM   #7 (permalink)
Trading Apprentice
Cleveland, Ohio
Futures Experience: Advanced
Platform: ToS
Favorite Futures: 6E
Posts: 4 since Jul 2010
Thanks: 2 given, 0 received

Here's another ThinkScript reference site:

The original post asked about drawing lines above/below breakout levels. Have you looked at the TOS DarvasBox Study for ideas?
I've not posted enough here to include a link, sorry.

Reply With Quote

Old April 23rd, 2012, 06:43 PM   #8 (permalink)
Trading Apprentice
boston mass
Futures Experience: Intermediate
Platform: nt
Favorite Futures: futures
Posts: 2 since Apr 2012
Thanks: 0 given, 0 received

nt to TOS

Hello I have a custom nt indicator fairly simple one. Is it possible to get it translated so I can see if it will work well with TOS? Itshould its not auto execute just sort of rollingaversge I dictator. Thnc

Reply With Quote

Old March 8th, 2016, 10:21 AM   #9 (permalink)
Trading Apprentice
Calgary Canada
Futures Experience: Intermediate
Platform: ThinkorSwim
Favorite Futures: Gold GC, Currency, Crude
Posts: 8 since Feb 2016
Thanks: 3 given, 0 received


Reply With Quote

Old March 8th, 2016, 03:13 PM   #10 (permalink)
Trading Apprentice
Paris France
Futures Experience: Beginner
Platform: TradingView
Broker/Data: CQG
Favorite Futures: ES1!, CL1!, DY1!
Pharmakon's Avatar
Posts: 37 since Jan 2016
Thanks: 100 given, 17 received

oztrd View Post
these sites but here goes.

ThinkScripter Community Forum - Give Help, Get Help, Pay it Forward

Thinkorswim thinkscript library

you should also check the forum on

good luck,

Hi ! Thanks for these links. Do you know also a post about how start ToS Script to do automated trading on PaperMoney ?

Best Regards,

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming > ThinkScript (TOS) Programming Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Programming (programming without coding) LukeGeniol Platforms and Indicators 11 September 16th, 2016 12:49 PM
ThinkScript studies c0ol2 ThinkOrSwim 5 April 8th, 2014 12:50 PM
ThinkScript: Three Line Break StockJock ThinkOrSwim Programming 0 December 16th, 2010 11:10 AM
Thinkscript Volatility Indicator tosmonkey ThinkOrSwim Programming 4 November 29th, 2010 04:29 PM

All times are GMT -4. The time now is 04:58 PM.

Copyright © 2016 by 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

Page generated 2016-10-25 in 0.12 seconds with 20 queries on phoenix via your IP