//------------------------------------//
// Heikin Ashi
//------------------------------------//
once haopen=open
haclose=(open+close+high+low)/4
if barindex> 0 then
haopen=(haopen+haclose[1])/2
endif
halow=min(low,min(haclose,haopen))
hahigh=max(high,max(haclose,haopen))
//------------------------------------//
// Doji
//------------------------------------//
irange=hahigh-halow
body=abs(haclose-haopen)
doji = body < irange*0.15
//------------------------------------//
// Setup
//------------------------------------//
slpip=10
if not onmarket and doji then
stoploss=halow-slpip*pipsize
buy 1 contract at hahigh stop
set stop price stoploss
endif
if onmarket and close crosses under average[10](close) then
sell at market
endif
graphonprice average[10](close) coloured("blue")
graphonprice stoploss coloured("red")