MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

CandlCode & ICS by Viktor Likhovidov

body

Abs(O-C)

lshd

If(C>=O,O-L,C-L)

ushd

If(C>=O,H-C,H-O)

For each component of the candle, two thresholds (bottom and top) are established through the Bollinger Bands:

ThBot_b

BBandBot(Fml("body"), 55, E, 0.5)

ThTop_b

BBandTop(Fml("body"), 55, E, 0.5)

ThBot_l

BBandBot(Fml("lshd"), 55, E, 0.5)

ThTop_l

BBandTop(Fml("lshd"), 55, E, 0.5)

ThBot_u

BBandBot(Fml("ushd"), 55, E, 0.5)

ThTop_u

BBandTop(Fml("ushd"), 55, E, 0.5)

Calculation of the candle code is divided into three steps for convenience:

CandleCode-b

If(CLOSE=OPEN,1,0) *
If(Fml("ushd") >= Fml("lshd"),64,48) + If(CLOSE=OPEN,0,1) * (If(CLOSE>OPEN,1,0) *
(If(Fml("body") <= Fml("ThBot_b"),80,0)+ If(Fml("body") > Fml("ThBot_b") AND
Fml("body") <= Fml("ThTop_b"),96,0) + If(Fml("body") > Fml("ThTop_b" ),112,0)) +
If(CLOSE<OPEN,1,0) * (If(Fml("body") <= Fml("ThBot_b"),32,0) +
If(Fml("body") > Fml("ThBot_b") AND Fml("body") <= Fml("ThTop_b"),16,0)))

CandleCode-l

If(Fml("lshd") = 0,3,0) + If(Fml("lshd") < Fml("ThBot_l") AND
Fml("lshd") > 0,2,0)+ If(Fml("lshd") > Fml("ThBot_l") AND
Fml("lshd") <= Fml("ThTop_l") ANDFml("lshd") > 0,1,0)

CandleCode-u

If(Fml("ushd") > 0 AND Fml("ushd") <= Fml("ThBot_u"), 4, 0) +
If(Fml("ushd") > Fml("ThBot_u") AND Fml("ushd") <= Fml("ThTop_u"), 8, 0)+
If(Fml("ushd") > Fml("ThTop_u"), 12, 0)

The resulting candle code is the sum of the three above:

CandlCode

Fml( "CandleCode-b" ) + Fml( "CandleCode-l" ) + Fml( "CandleCode-u" )

The smoothed indicator:

ICS

Periods:=Input("Enter Periods",2,13,2);
Mov(Mov(Mov(Fml("CandlCode"),Periods,S),Periods,S),Periods,S)

Source / From: TOP