user input specific time in TOS script. - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


user input specific time in TOS script.
Updated: Views / Replies:1,503 / 7
Created: by Stocktrader 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

Reply
 
Thread Tools Search this Thread
 

user input specific time in TOS script.

  #1 (permalink)
Elite Member
Dublin Ireland
 
Futures Experience: Intermediate
Platform: Ninja, TOS
Broker/Data: RCG Direct/Continuum
Favorite Futures: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 5 received

user input specific time in TOS script.

I am trying to draw the TOS TPOProfile indicator from a user input specific time - say 7am - using a tick chart. Obviously a tick derived bar may not start at exactly 7am. How do I achieve this?

I have created an input starttime = 0700; (for 7am) and then replaced the (0) in line 18 with starttime but I am still not drawing the profile from 7am or the bar that opens after 7am.

I have tried lots of other combinations and permutations (and crashed TOS !) but with no success.

I have been through the other indicators but cannot find an example to copy - if you know of any please point me in the right direction or point out where I am going wrong.

Thanks.

Reply With Quote
 
  #2 (permalink)
Trading Apprentice
Carthage Texas Usa
 
Futures Experience: Intermediate
Platform: etrade
Favorite Futures: options
 
Posts: 15 since Jun 2015
Thanks: 0 given, 2 received


Stocktrader View Post
I am trying to draw the TOS TPOProfile indicator from a user input specific time - say 7am - using a tick chart. Obviously a tick derived bar may not start at exactly 7am. How do I achieve this?

I have created an input starttime = 0700; (for 7am) and then replaced the (0) in line 18 with starttime but I am still not drawing the profile from 7am or the bar that opens after 7am.

I have tried lots of other combinations and permutations (and crashed TOS !) but with no success.

I have been through the other indicators but cannot find an example to copy - if you know of any please point me in the right direction or point out where I am going wrong.

Thanks.

To the best of my knowledge this may be a little trick because of the way aggregation time is done on intra-day. You have to do some math in the script and divide 3600 for hour, 1800 for 30 min and so on. But that is with a time chart. I will have to check about the tick charts and secondary aggregation. If you need more help let me know

Reply With Quote
The following user says Thank You to HaydenP for this post:
 
  #3 (permalink)
Elite Member
Dublin Ireland
 
Futures Experience: Intermediate
Platform: Ninja, TOS
Broker/Data: RCG Direct/Continuum
Favorite Futures: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 5 received


Hi thanks for taking a look - You are right regards the aggregation in TOS. I haven't spent much time on this yet this week.

I have been trying to convert code from my NT indy but it looks like I will have to create an imaginative work around in order to define the start bar for drawing the profile. This is easy using a timed based aggregation and is already a feature of the indy but getting it to draw a profile from the bar nearest to 7am or whatever the user inputs when using tick derived bars is proving a headache.

I have found a pivot indicator that uses an input to draw the lines 'from' and 'to' - I will test this with tick bars and see how it works - a bit long winded but it may be a work around.

I will keep posting and any other input gratefully received.

Ben.

Just to be clear I want to draw a profile say every 4 hours using the existing settings within the indy but I want to be able to specify that it starts the profile at say 6am using a tick derived bar - NOT the first bar of the session.
It may be a case of defining something like startbar = the nth bar after the start of the session that is closest to the users input time. In NT this is easy - if it's easy in TOS please let me know - I haven't engaged the cogs on this line of thought yet!


Last edited by Stocktrader; June 10th, 2015 at 08:36 AM. Reason: Additional thought
Reply With Quote
 
  #4 (permalink)
Trading Apprentice
Carthage Texas Usa
 
Futures Experience: Intermediate
Platform: etrade
Favorite Futures: options
 
Posts: 15 since Jun 2015
Thanks: 0 given, 2 received


Stocktrader View Post
Hi thanks for taking a look - You are right regards the aggregation in TOS. I haven't spent much time on this yet this week.

I have been trying to convert code from my NT indy but it looks like I will have to create an imaginative work around in order to define the start bar for drawing the profile. This is easy using a timed based aggregation and is already a feature of the indy but getting it to draw a profile from the bar nearest to 7am or whatever the user inputs when using tick derived bars is proving a headache.

I have found a pivot indicator that uses an input to draw the lines 'from' and 'to' - I will test this with tick bars and see how it works - a bit long winded but it may be a work around.

I will keep posting and any other input gratefully received.

Ben.

I was in error in the post I sent.....I will test it correctly and get back.

Hayden

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Carthage Texas Usa
 
Futures Experience: Intermediate
Platform: etrade
Favorite Futures: options
 
Posts: 15 since Jun 2015
Thanks: 0 given, 2 received

Hey


Stocktrader View Post
Hi thanks for taking a look - You are right regards the aggregation in TOS. I haven't spent much time on this yet this week.

I have been trying to convert code from my NT indy but it looks like I will have to create an imaginative work around in order to define the start bar for drawing the profile. This is easy using a timed based aggregation and is already a feature of the indy but getting it to draw a profile from the bar nearest to 7am or whatever the user inputs when using tick derived bars is proving a headache.

I have found a pivot indicator that uses an input to draw the lines 'from' and 'to' - I will test this with tick bars and see how it works - a bit long winded but it may be a work around.

I will keep posting and any other input gratefully received.

Ben.

Just to be clear I want to draw a profile say every 4 hours using the existing settings within the indy but I want to be able to specify that it starts the profile at say 6am using a tick derived bar - NOT the first bar of the session.
It may be a case of defining something like startbar = the nth bar after the start of the session that is closest to the users input time. In NT this is easy - if it's easy in TOS please let me know - I haven't engaged the cogs on this line of thought yet!

What indicator were you using in NT. I want to see if I can convert it with some of this software I have collected over the years.

Reply With Quote
 
  #6 (permalink)
Elite Member
Dublin Ireland
 
Futures Experience: Intermediate
Platform: Ninja, TOS
Broker/Data: RCG Direct/Continuum
Favorite Futures: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 5 received

NT script below is from the DrawVerticalLine indy – you can also look at the dValue indy. In NT you can simply use

Bars.GetBar() or you can use BarsSinceSession()

The problem in TOS is identifying the bar that opens after the user input time (just to keep it simple) - if we wanted to get the closest open to the users input time we would have to compare open[0] and open[1] then plot ….. but the main problem is identifying the bar to start the plot from.

I will be able to do more on this at the weekend.

Ben.



protected override void OnBarUpdate()
{
if (CurrentBar < 1) { return; }
// Determine if this bar fits the time parameters and plot if so...
if (Time[0].TimeOfDay.CompareTo(timeToPlot) >= 0 && Time[1].TimeOfDay.CompareTo(timeToPlot) < 0)
{
this.DrawLine("VertTop" + CurrentBar.ToString(), false, Time[0], High[0] + (BarToLineOffsetInTicks * TickSize), Time[0],
High[0] + LineLengthInTicks*TickSize, LineColor, LineStyle, LineSize);

this.DrawLine("VertBottom" + CurrentBar.ToString(), false, Time[0], Low[0] - (BarToLineOffsetInTicks * TickSize), Time[0],
Low[0] - LineLengthInTicks*TickSize, LineColor, LineStyle, LineSize);

DrawText("" + CurrentBar.ToString(), true, LineLabel,0, Low[0] - ((LineLengthInTicks*TickSize) + LabelOffset*TickSize),0, LineColor, TextFont, Alignment, Color.Transparent, Color.Transparent, 0);// ORIGINAL - ("" + CurrentBar.ToString(), LineLabel, 0, Low[0] - ((LineLengthInTicks*TickSize) + 4*TickSize), LineColor); //Instrument.MasterInstrument.Name + "\n" +
PlaySound(@"OpeningBell.wav");
}

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Carthage Texas Usa
 
Futures Experience: Intermediate
Platform: etrade
Favorite Futures: options
 
Posts: 15 since Jun 2015
Thanks: 0 given, 2 received

Aggregation


Stocktrader View Post
NT script below is from the DrawVerticalLine indy – you can also look at the dValue indy. In NT you can simply use

Bars.GetBar() or you can use BarsSinceSession()

The problem in TOS is identifying the bar that opens after the user input time (just to keep it simple) - if we wanted to get the closest open to the users input time we would have to compare open[0] and open[1] then plot ….. but the main problem is identifying the bar to start the plot from.

I will be able to do more on this at the weekend.

Ben.


Code Removed to save space
}

Are you trying to start from a time that you input, and are you using Tick or time based aggregation.

I don't suppose this would help ...?

input StartAggregation= 0930;
input StartPlotTime= 1;
def durationSec = StartPlotTime* 60 * 60;
def secondsPassed = SecondsFromTime(OpenTime);
plot Price = if secondsPassed >= 0 and secondsPassed <= durationSec then close else double.NaN;

H

One other thing I forgot to mention is that a limitation of ToS is that the lowest time frame that cn be accessed on a tick chart is 1 day


Last edited by HaydenP; June 21st, 2015 at 11:27 PM. Reason: Addition
Reply With Quote
The following user says Thank You to HaydenP for this post:
 
  #8 (permalink)
Elite Member
Dublin Ireland
 
Futures Experience: Intermediate
Platform: Ninja, TOS
Broker/Data: RCG Direct/Continuum
Favorite Futures: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 5 received

Think i have got to the bottom of this one - haven't solved it completely as I have been busy but the Volume profile has a StartNewProfile parameter. All one needs to do is define the start time and then plot the profile turns out to be quite simple i think. All you have to do is write the condition if open of current bar is > 7am(user input time) then profile myProfile = VolumeProfile(Symbol, PricePerRow.TickSize, myStartCondition, Not on expansion, #ofprofiles 6, Va=68%);
myProfile.Show(.....etc );

obviously I haven't tested this yet but will get round to it this week.

Reply With Quote

Reply



futures io > > > > > user input specific time in TOS script.

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
User input to running NT strategy gain247 NinjaTrader Programming 12 April 17th, 2015 02:19 PM
Follow specific user list? wldman Traders Hideout 5 February 16th, 2014 08:42 AM
Input from user in expert advisor ankityadav MetaTrader 0 July 25th, 2013 08:51 AM
Searching for posts by a specific user issue. dakine Feedback and Announcements 1 December 20th, 2011 09:35 PM
User input box UManiac NinjaTrader Programming 5 September 21st, 2010 08:57 PM


All times are GMT -4. The time now is 11:40 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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 2017-12-15 in 0.15 seconds with 19 queries on phoenix via your IP 54.163.210.170