Code: Select all

` //overlapping price action`

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

midpoint = (high + pmidpoint) /2;

if(midpoint > phigh) {theValue = (close - midpoint) / point; twMESSAGE = "mid[B0] "+DoubleToStr(theValue, 0); twCOLOR = colorHigh;}else

if(close > phigh) {theValue = (close - midpoint) / point; twMESSAGE = "breakout " + DoubleToStr(theValue, 0); twCOLOR = clrDodgerBlue;}else

if(close < phigh) {theValue = (phigh - close) / point; twMESSAGE = "reversed " + DoubleToStr(theValue, 0); twCOLOR = colorHigh;}}else

//overlapping price action

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

midpoint = (low + pmidpoint) /2;

if(midpoint < plow) {theValue = (midpoint - close) / point; twMESSAGE = "mid[B0] "+DoubleToStr(theValue, 0) ; twCOLOR = colorLow;}else

if(close < plow) {theValue = (midpoint - close) / point; twMESSAGE = "breakout " + DoubleToStr(theValue, 0); twCOLOR = clrDodgerBlue;}else

if(close > plow) {theValue = (close - plow) / point; twMESSAGE = "reversed " + DoubleToStr(theValue, 0); twCOLOR = colorLow;}}else

//no overlap reverse

if( high > phigh && midpoint > pmidpoint && close < phigh ) { theValue = (phigh - close ) / point ; twMESSAGE = "reversed " + DoubleToStr(theValue, 0) ; twCOLOR = colorHigh ; myThreshold = 0; } else

if( low < plow && midpoint < pmidpoint && close > plow ) { theValue = (close - plow) / point ; twMESSAGE = "reversed " + DoubleToStr(theValue, 0) ; twCOLOR = colorLow ; myThreshold = 0; } else

//no overlap breakout

if(midpoint > phigh && close >= phigh) {theValue = (close - midpoint) / point ; twMESSAGE = "mid[B0] " + DoubleToStr(theValue, 0) ; twCOLOR = colorHigh ;}else

if(midpoint < plow && close <= plow) {theValue = (midpoint - close) / point; twMESSAGE = "mid[B0] " + DoubleToStr(theValue, 0) ; twCOLOR = colorLow ;} else

The easy to understand version:

1) trade away from the current midpoint

2) if there is a breakout then trade long above or short below the extreme

3) if the midpoint is higher than the previous high then trade long above it or short below the midpoint

midpoints:

1) if the current candle breaks the high of the previous and has an extreme that is at or below the previous midpoint then the

midpoint = (high + previousMidpoint) / 2

2)else midpoint = (high + low) / 2

high/low extremes:

if the high of the current candle is lower than the previous close then the high equals the previous close

if the low of the current candle is higher than the previous close then the low equals the previous close.