# Heikin Ashi Bullish/Bearish Trend Change _JQ
# v01 dated 9.23.2018
# Scans for a change in the Heikin Ashi Trend to Bull from Bear
# relies on RHouser HA candle description code
def xClose = ( open + high + low + close ) / 4;
rec xOpen = compoundValue( 1, ( xOpen[1] + xClose[1] ) / 2, xClose );
def Bullish = if ( xClose - xOpen ) >= 0 then yes else no;
def Bearish = if ( xClose - xOpen ) <= 0 then yes else no;
def BullishChange = if ( xClose - xOpen ) >= 0 and ( xClose[1] - xOpen[1] ) <= 0 then yes else no;
def BearishChange = if ( xClose - xOpen ) <= 0 and ( xClose[1] - xOpen[1] ) >= 0 then yes else no;
#plot Scan = Bullish;
#plot Scan = Bearish;
plot Scan = BullishChange;
#plot Scan = BearishChange;