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:539 / 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 90,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)

Updating schedule soon for June


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 01:31 AM
Porting the "Traders Dynamic Index" to TOS Zephyr ThinkOrSwim Programming 24 August 8th, 2014 04:20 PM
Fukushima: "China Syndrome Is Inevitable" ... "Huge Steam Explosions", or "Nuclear Bo Quick Summary News and Current Events 0 November 22nd, 2011 01:50 AM
How to change "Stop Loss" and "Take Profit" in "shElderImpulse" Strategy javed759 NinjaTrader 1 November 1st, 2011 10:44 PM
"mid", "buy", "sell" volumes lokgotkent Traders Hideout 6 September 30th, 2011 01:24 PM

All times are GMT -4. The time now is 01:38 AM.

Copyright © 2018 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
Page generated 2018-06-25 in 0.07 seconds with 19 queries on phoenix via your IP