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.

Can you help answer these questions from other members on futures io?

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.

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;

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....

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.