a0:=dma(amount/(c*v),v/capital);
a2:=(3*h+2*max(ref(max(c,o),1),max(c,o))+3*min(ref(min(c,o),1),min(c,o))+l)/9;
a3:=SUM(IF(a2>REF(a2,1),a0,IF(a2<REF(a2,1),-a0 ,0)),0)/100;
t1:a3,coloryellow;
MID : ma(a3,29) ,colorgreen;
h1:mid+1.382*std(a3,29),colormagenta;
l1:mid-1.382*std(a3,29),colormagenta;