NexusFi: Find Your Edge


Home Menu

 





MID price indicator for TOS


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one smegey with 5 posts (0 thanks)
    2. looks_two devildriver6 with 3 posts (10 thanks)
    3. looks_3 Shortline with 2 posts (0 thanks)
    4. looks_4 Semifaded with 2 posts (0 thanks)
    1. trending_up 10,885 views
    2. thumb_up 12 thanks given
    3. group 12 followers
    1. forum 18 posts
    2. attach_file 0 attachments




 
Search this Thread

MID price indicator for TOS

  #1 (permalink)
 smegey 
Sydney
 
Experience: None
Platform: TOS
Trading: Futures
Posts: 6 since Jun 2011
Thanks Given: 1
Thanks Received: 0

Hi,

Futurestrader71 talks about the 'mid' alot. I have been trying to implement this level on my TOS charts but cant figure it out. I tried to create a simple moving average with a look back of 78 periods (5 min chart) with a calculation of (H+L)/2. Doesnt seem right.

FT71 did tweet and say "it charts the average of the high & low throughout whatever session I have selected. Generally pit only" - This is in relation to E-Mini S&P500 futures.

Anyone know how to calculate this in a script or define it in a study in TOS. Thanks in advance.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
  #2 (permalink)
devildriver6
Dallas, Texas
 
Posts: 43 since Jun 2015
Thanks Given: 2
Thanks Received: 32


smegey View Post
Hi,

Futurestrader71 talks about the 'mid' alot. I have been trying to implement this level on my TOS charts but cant figure it out. I tried to create a simple moving average with a look back of 78 periods (5 min chart) with a calculation of (H+L)/2. Doesnt seem right.

FT71 did tweet and say "it charts the average of the high & low throughout whatever session I have selected. Generally pit only" - This is in relation to E-Mini S&P500 futures.

Anyone know how to calculate this in a script or define it in a study in TOS. Thanks in advance.

You need to first define the period in which you want the mid price.
Then, once you've established a starting point, you want the highest high and lowest low.

This will give you the mid point during RTH's....

Here's the code I have to do this:

input CapturePeriodStart = 0930;
input CapturePeriodEnd = 1615;

input StartPlotTime = 0930;
input EndPlotTime = 2359;

def CapturePeriodHasBegun = secondsFromTime(CapturePeriodStart) > 0;
def FirstBarOfCapturePeriod = !CapturePeriodHasBegun[1] and CapturePeriodHasBegun;
def PriorPeriod = secondsFromTime(CapturePeriodStart) > 0 or secondsFromTime(CapturePeriodEnd) < 0;
def PlotPeriod = secondsFromTime(StartPlotTime) > 0 && secondsTillTime(EndPlotTime) > 0;
rec PriorPeriodHigh = if IsNaN(PriorPeriodHigh[1]) or PriorPeriodHigh[1] < 2 then high
else if FirstBarOfCapturePeriod then high else if PriorPeriod && high > PriorPeriodHigh[1] then
high else PriorPeriodHigh[1];

rec PriorPeriodLow = if IsNaN(PriorPeriodLow[1]) or PriorPeriodLow[1] < 2 then low else
if FirstBarOfCapturePeriod then low else if PriorPeriod && low < PriorPeriodLow[1] then low else
PriorPeriodLow[1];

def TheHigh = if PlotPeriod && PriorPeriodHigh > 2 then PriorPeriodHigh else
double.nan;

def TheLow = if PlotPeriod && PriorPeriodLow > 2 then PriorPeriodLow else
double.nan;

plot midpoint = (thehigh + thelow) / 2;
midpoint.setdefaultColor(color.yellow);
midpoint.setlineWeight(3);

Reply With Quote
Thanked by:
  #3 (permalink)
 smegey 
Sydney
 
Experience: None
Platform: TOS
Trading: Futures
Posts: 6 since Jun 2011
Thanks Given: 1
Thanks Received: 0


Thank you very much. Ill give this a try and see how it goes!

Started this thread Reply With Quote
  #4 (permalink)
 smegey 
Sydney
 
Experience: None
Platform: TOS
Trading: Futures
Posts: 6 since Jun 2011
Thanks Given: 1
Thanks Received: 0

Devildriver6 - Have you compared your script to FT71 charts? On his traderbites it seems very close but not the same. Just wondering if its me or indeed its a tad different. Perhaps its user error on my part....

Any thoughts? Tyvm again for this

Started this thread Reply With Quote
  #5 (permalink)
Semifaded
San Francisco Ca/USA
 
Posts: 10 since Jan 2018
Thanks Given: 0
Thanks Received: 3

This midline is incorrect?

Reply With Quote
  #6 (permalink)
 smegey 
Sydney
 
Experience: None
Platform: TOS
Trading: Futures
Posts: 6 since Jun 2011
Thanks Given: 1
Thanks Received: 0

Seems alright to me

Started this thread Reply With Quote
  #7 (permalink)
devildriver6
Dallas, Texas
 
Posts: 43 since Jun 2015
Thanks Given: 2
Thanks Received: 32


smegey View Post
Seems alright to me


Yeah, not sure about Traderbites, but that's the mid price.
Do you know how his is calculated?

Reply With Quote
  #8 (permalink)
 smegey 
Sydney
 
Experience: None
Platform: TOS
Trading: Futures
Posts: 6 since Jun 2011
Thanks Given: 1
Thanks Received: 0


devildriver6 View Post
Yeah, not sure about Traderbites, but that's the mid price.
Do you know how his is calculated?

By 'his' you mean FT71 I am assuming - I'd just tweet him or reach out to his prop desk and ask for the actual calc.

Started this thread Reply With Quote
  #9 (permalink)
Semifaded
San Francisco Ca/USA
 
Posts: 10 since Jan 2018
Thanks Given: 0
Thanks Received: 3


devildriver6 View Post
Yeah, not sure about Traderbites, but that's the mid price.
Do you know how his is calculated?

hmmm.... I am looking at it right now. /ESh8 chart and the hi is 2748.5, low is 2723.75... so mid should be 2736.13.. and the midline is 2737.13. It is usually always off a point or so.

Reply With Quote
  #10 (permalink)
 
Shortline's Avatar
 Shortline 
Lake Stevens, WA
 
Experience: Intermediate
Platform: NinjaTrader, TOS, IB exec
Broker: Interactive Brokers
Trading: ES CL
Posts: 46 since Aug 2016
Thanks Given: 38
Thanks Received: 43



Semifaded View Post
hmmm.... I am looking at it right now. /ESh8 chart and the hi is 2748.5, low is 2723.75... so mid should be 2736.13.. and the midline is 2737.13. It is usually always off a point or so.

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.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on September 29, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts