user input specific time in TOS script. - futures io
futures io futures trading



user input specific time in TOS script.


Discussion in ThinkOrSwim

Updated
    1. trending_up 6,095 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 7 posts
    2. attach_file 0 attachments




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

 
Search this Thread
 

user input specific time in TOS script.

(login for full post details)
  #1 (permalink)
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 7 received

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.

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Short Interest Ratio indicator?
ThinkOrSwim
What blockvolume is visible? - order processing
NinjaTrader
Which kind of Blockvolume is visible? - order processing
Emini and Emicro Index
Reading A set of Trading Signals
EasyLanguage Programming
Webinar: Finding your own way in trading w/Adam Grimes
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
111 thanks
Selling Options on Futures?
109 thanks
Rank your Futures vs Stocks trading priority
37 thanks
Want your NinjaTrader indicator created, free?
26 thanks
Bitcoin storage wallet recommendations
18 thanks
 
(login for full post details)
  #2 (permalink)
Carthage Texas Usa
 
 
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:
 
(login for full post details)
  #3 (permalink)
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 7 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!

Started this thread Reply With Quote
 
(login for full post details)
  #4 (permalink)
Carthage Texas Usa
 
 
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
 
(login for full post details)
  #5 (permalink)
Carthage Texas Usa
 
 
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.

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
 
(login for full post details)
  #6 (permalink)
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 7 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");
}

Started this thread Reply With Quote
 
(login for full post details)
  #7 (permalink)
Carthage Texas Usa
 
 
Posts: 15 since Jun 2015
Thanks: 0 given, 2 received


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

Reply With Quote
The following user says Thank You to HaydenP for this post:
 
(login for full post details)
  #8 (permalink)
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
 
Posts: 18 since Mar 2012
Thanks: 4 given, 7 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.

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators ThinkOrSwim > user input specific time in TOS script.


Last Updated on July 19, 2015


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



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