Sacrophage wrote:Hotness. Send it TRO! MO, previous means the last candle, or is there a lookback parameter to find a previous H/L?

Candle[1] is previous.

I go back as far as candle[2] for the midpoint calculation:

if(plow > ppclose){plow = ppclose;}

if(phigh < ppclose){phigh = ppclose;}

pmidpoint = (phigh + plow)/2;

The current midpoint is found in a similar way:

if(low > pclose){low = pclose;}

if(high < pclose){high = pclose;}

midpoint = (high + low)/2;

This is the "deep reversal" aka midpoint break-in (mid[BI]):

if( high > phigh && midpoint > pmidpoint && close < pmidpoint || low < plow && midpoint < pmidpoint && close > pmidpoint){ ...

If the number is negative then you know that it broke the previous high and reversed and if it is positive then you can be sure that price broke the previous low and reversed. The bias is the long above / short below the previous extreme, the mid[BI] just gives a new point at which to continue that bias.

mid[B0]:

if(midpoint > phigh && close >= phigh) {

reversed x:

if( high > phigh && midpoint > pmidpoint && close < phigh ) {