How to capture "seconds passed since..." in a variable in TOS - ThinkOrSwim | futures io social day trading
futures io futures trading


How to capture "seconds passed since..." in a variable in TOS
Updated: Views / Replies:585 / 1
Created: by jtbiz Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Thread Tools Search this Thread

How to capture "seconds passed since..." in a variable in TOS

  #1 (permalink)
Trading Apprentice
Futures Experience: None
Platform: TOS
Favorite Futures: Gold GC
Posts: 1 since Feb 2016
Thanks: 0 given, 0 received

How to capture "seconds passed since..." in a variable in TOS

Hi All,

I'm brand new to coding and have put together a few lines of code below. I am trying to find the slope of a line if drawn from low of day price to low of 1 bar ago. Scan will be run on 3 min charts.

I'm getting an error - "Secondary period not allowed: Day" on def X1 line. Any input will be helpful.


def Y1 = low;
def X1 = if secondsfromTime(930)<0 or secondsFromTime(930)>23400 then double.NaN else if low == low(period = AggregationPeriod.DAY) then secondsFromTime(930) else X1[1];

def Y2 = low from 1 bar ago;
def X2 = secondsFromTime(930);

def Slope = (Y2-Y1)/(X2-X1);
plot met = if slope>=0.5 and slope <=1 then 1 else 0;

Reply With Quote
  #2 (permalink)
Trading Apprentice
New Orleans LA
Futures Experience: Intermediate
Platform: ThinkorSwim
Favorite Futures: CL ES HO
Posts: 1 since Dec 2017
Thanks: 0 given, 0 received

set agg period

You must first set the aggregation period

Reply With Quote


futures io > > > > How to capture "seconds passed since..." in a variable in TOS

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Fundraiser: Feeding Families in Need (ends Dec 17)


Battlestations! Show us your trading desks w/GFF Brokers ($750 in Prizes)


An Afternoon With Morad Askar (aka FuturesTrader71)

Elite only

Traders Tax Advice w/Ryan Curran CPA

Elite only

Black Swan Events w/Adam Grimes

Elite only

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Free" platforms/datafeeds OEC, TA, TOS. upsolow Reviews of Brokers and Data Feeds 23 February 14th, 2015 02:31 AM
Porting the "Traders Dynamic Index" to TOS Zephyr ThinkOrSwim Programming 24 August 8th, 2014 05:20 PM
Fukushima: "China Syndrome Is Inevitable" ... "Huge Steam Explosions", or "Nuclear Bo Quick Summary News and Current Events 0 November 22nd, 2011 02:50 AM
How to change "Stop Loss" and "Take Profit" in "shElderImpulse" Strategy javed759 NinjaTrader 1 November 1st, 2011 11:44 PM
"mid", "buy", "sell" volumes lokgotkent Traders Hideout 6 September 30th, 2011 02:24 PM

code, es, how to, slope, think or swim, thinkorswim, tos, variable

All times are GMT -4. The time now is 03:55 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business,
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 2018-12-15 in 0.07 seconds with 14 queries on phoenix