//Bias Determinator
//09/12/2017
//Marcel van Vliet
//--- parameters
// EMAperiod=34
// mmTYPE=1 (mm type)
// ---
EMAh = exponentialaverage[34](close)
EMAl = exponentialaverage[55](close)
bodyhigh = max(open,close)
bodylow = min(open,close)
if(open<=close and close > EMAH) then
LongWickUp = high
LongCandleUp = bodyHigh
LongWickDown = low
LongCandleDown = bodyLow
elsif(open>=close and close > EMAH) then
LongWickUp = low
LongCandleUp = bodyLow
LongWickDown = high
LongCandleDown = bodyHigh
elsif(open<=close and close < EMAL) then
ShortWickUp = high
ShortCandleUp = bodyHigh
ShortWickDown = low
ShortCandleDown = bodyLow
elsif(open>=close and close < EMAL) then
ShortWickUp = high
ShortCandleUp = bodyHigh
ShortWickDown = low
ShortCandleDown = bodyLow
elsif(open<=close and close < EMAH and close > EMAL) then
RangeWickUp = high
RangeCandleUp = bodyHigh
RangeWickDown = low
RangeCandleDown = bodyLow
elsif(open>=close and close < EMAH and close > EMAL) then
RangeWickUp = low
RangeCandleUp = bodyLow
RangeWickDown = high
RangeCandleDown = bodyHigh
endif
//bullish candlesticks
if close>EMAH then
DRAWCANDLE(LongCandleDown,LongWickUp,LongWickDown,LongCandleUp) coloured(0,0,102)
endif
//Neutral candlesticks above the MA
If close>EMAH and close<open then
DRAWCANDLE(LongCandleDown,LongWickUp,LongWickDown,LongCandleUp) coloured(150,150,150)
Endif
//bearish candlesticks
if close<EMAL then
DRAWCANDLE(ShortCandleDown,ShortWickUp,ShortWickDown,ShortCandleUp) coloured(204,0,0)
endif
//Neutral candlesticks under the MA
If close<EMAL and close>open then
DRAWCANDLE(ShortCandleDown,ShortWickUp,ShortWickDown,ShortCandleUp) coloured(150,150,150)
Endif
//neutral candlesticks (range)
if close<EMAH and close>EMAL then
DRAWCANDLE(RangeCandleDown,RangeWickUp,RangeWickDown,RangeCandleUp) coloured(150,150,150)
endif
RETURN EMAH coloured(204,204,204) style(line) as "high EMA", EMAL coloured(102,102,102) style(line) as "low EMA"