require "Color"
require "TIlib"

$Names[0] = "EMA(20)"
$Colors[0] = $Blue
$Names[1] = "+5%"
$Colors[1] = $Green
$Names[2] = "-5%"
$Colors[2] = $Green
$Names[3] = "+10%"
$Colors[3] = $Red
$Names[4] = "-10%"
$Colors[4] = $Red

Candle_draw($White, $Blue)

if !$EMA
    $EMA = EMA_new(20)
else
    EMA_next($EMA)
    MA_drawEnvelope($EMA, $Colors[0], 5, $Colors[1], 10, $Colors[3])
end
Indicator(0, $EMA[1])
Indicator(1, $EMA[1] * 1.05)
Indicator(2, $EMA[1] * 0.95)
Indicator(3, $EMA[1] * 1.1)
Indicator(4, $EMA[1] * 0.9)
