MID price indicator for TOS - ThinkOrSwim | futures io social day trading
futures io futures trading


MID price indicator for TOS
Updated: Views / Replies:3,253 / 14
Created: by smegey 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 dont 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
 

MID price indicator for TOS

  #11 (permalink)
Dallas, Texas
 
 
Posts: 43 since Jun 2015
Thanks: 2 given, 24 received


Shortline View Post
The logic of the script combined with ToS methodology is causing the recursive function to start one bar later than intended.

If you set the following two inputs to 1 bar prior to what you actually want the script will work accurately:

CapturePeriodStart
StartPlotTime

For example, if you are using a 5 minute intraday chart, if you set the above tow parameters to 0925 the values will be correct.

Unfortunately, if you change timeframes without adjusting these parameters it the midline will be inaccurate again.

I'm sure there is some logic that could be built into the script but I did not take the time to investigate that, sorry.

Additional Note: I just realized that if the chart is not showing the extended trading hours session the above hack does not work. Back to the drawing board.




For everyone following this thread, I figured out a more "elegant" way to do this, which is now correct.
This will reset daily, regardless of timeframe (as long as the timeframe is lower than the midpoint you're tracking), as well as provides Daily, Weekly, and Monthly midpoints, as desired.

Lastly, this gives you the option to see the High and Low it's using or hide it, as needed, and rounds the Mid Point to the nearest tick value.

Here's what it looks like (showing the high and low, which you can hide):

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Here's the code:
## Provided by @The_Dude_Trader on Stocktwits / Twitter##
## For personal use only##
## Come see more at @DTWCoachandDude on Stocktwits / Twitter / Facebook ##
## https://www.secretsociety7.com ##


input timeFrame = {default DAY, WEEK, MONTH} ;
input ShowHiLo = no ;


def cap = GetAggregationPeriod() ;
def errorInAggregation =
timeFrame == timeFrame.DAY and cap >= AggregationPeriod.WEEK or
timeFrame == timeFrame.WEEK and cap >= AggregationPeriod.MONTH ;
Assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period") ;

def yyyyMmDd = GetYYYYMMDD() ;
def periodIndx;
switch (timeFrame) {
case DAY:
periodIndx = yyyyMmDd ;
case WEEK:
periodIndx = Floor((DaysFromDate(First(yyyyMmDd)) + GetDayOfWeek(First(yyyyMmDd))) / 7) ;
case MONTH:
periodIndx = RoundDown(yyyyMmDd / 100, 0) ;
}
def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes) ;

def HI ;
def LO ;

if (isPeriodRolled) {
HI = high ;
LO = low ;
} else {
HI = if high > HI[1] then high else HI[1] ;
LO = if low < LO[1] then low else LO[1] ;
}

def NA = double.NaN ;

plot TheHI = if ShowHiLo then HI else NA ;
plot TheLO = if ShowHiLo then LO else NA ;
plot TheMid = round(((HI + LO) / 2) / ticksize(), 0) * ticksize();

TheHI.setdefaultColor(color.green) ;
TheLO.setdefaultColor(color.red) ;
TheMid.setdefaultColor(color.yellow) ;
TheMid.setlineweight(2) ;


Last edited by devildriver6; March 21st, 2018 at 12:31 PM.
Reply With Quote
The following 5 users say Thank You to devildriver6 for this post:
 
  #12 (permalink)
Lake Stevens, WA
 
Trading Experience: Intermediate
Platform: NinjaTrader, TOS, IB exec
Broker/Data: Interactive Brokers
Favorite Futures: ES CL
 
Shortline's Avatar
 
Posts: 46 since Aug 2016
Thanks: 38 given, 43 received


devildriver6 View Post
For everyone following this thread, I figured out a more "elegant" way to do this, which is now correct.

Nice update! It is very elegant.

I like it. Thanks for sharing.

Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
  #13 (permalink)
New Orleans, Louisiana
 
Trading Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: Emini
 
Posts: 1 since Apr 2017
Thanks: 1 given, 0 received



devildriver6 View Post
For everyone following this thread, I figured out a more "elegant" way to do this, which is now correct.
;

The devil's in the details, as you already know, devildriver6. This indicator is quite elegant, and I love it, man. I have been looking for this for quite a while. You are da' man! Thank you very much!


Reply With Quote
 
  #14 (permalink)
Kingston, New York USA
 
 
Posts: 1 since Jun 2019
Thanks: 0 given, 0 received

A Thousand Thanks! ...

You have made my dream come true ... I'd been searching for a means of creating a mid-point indicator for my TOS intraday futures charts and some midnight cyber-surfing landed me here at Futures IO and your kind contribution to traders unable to craft Think Script ... Kind folks like you make the internet a wonder-filled playground ... Thanks again, George J Nicholson

Reply With Quote
 
  #15 (permalink)
los angeles + ca/usa
 
 
Posts: 1 since May 2017
Thanks: 0 given, 0 received

Thanks for the script

I had a simple version and this one really fits the bill. I struggled creating it on my own til I finally found my senses and found this one. Thanks devil

Reply With Quote

Reply



futures io > > > > MID price indicator for TOS




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

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$1,000 in Amazon Gift Cards being given away right now from GFF Brokers

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Show us your trading desks and win over $5,000 in prizes w/Jigsaw Trading

August
 

Webinar: AutoTrading World Cup Advisor w/GFF Brokers

Aug 22
 

Webinar: Suri Duddella (TBA)

Elite only
 

Webinar: Richard Bailey (TBA)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
TOS Draw Horizontal Line at Current Price Indicator needed ceramictilepro ThinkOrSwim 3 December 20th, 2017 10:45 PM
HORISONTAL PRICE LINE for TOS vit007 ThinkOrSwim 7 February 16th, 2017 12:02 PM
Need Daily Mid line indicator for Multiple Time frames traderbuddy NinjaTrader Programming 8 January 23rd, 2017 10:17 AM
Using Bid&Ask Prices vs Only Mid-Price in Backtest fintrabuji Platforms and Indicators 1 July 1st, 2015 03:13 PM
GREAT PIVOT(All level-mid-floor-camarilla) INDICATOR astrading NinjaTrader Programming 4 June 20th, 2010 08:10 AM


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

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