Прошу помочь с написанием индикатора (конверт с глаженый через ЕМА)
формула из метастока
EMA:=Input("Base EMA",1,100,22);
Factor:=Input("Factor",1,50,27);
avg:=Mov(C,EMA,E);
csize:= Stdev(2*Max(Abs(H-avg) ,Abs(L-avg)) / avg,100)*Factor/10;
{Use 100 days for stable channel size - default is 2.7 std}
Csize:= ValueWhen(1,
DayOfWeek()<Ref(DayOfWeek() ,-1) OR (
DayOfWeek()=Ref(DayOfWeek(),-1) AND DayOfMonth() <> Ref(DayOfMonth(),-1))
,Ref(csize,-1));
{ This pegs the Stdev to last bar of week and only changes once per week}
csize:=LastValue(csize);
{fix to constant using last value}
channel:=csize*avg;
avg+channel/2;
avg-channel/2;
avg;