Hello,
    Could someone look at this please...I can not see the 
    error...
    The cumCST should increment up to .13 but it is not 
happening..
     
    Thank you
    Anthony
     
    Buy=Cross(C,EMA(C,19));
    Sell=Cross(EMA(C,19),C) ; 
    CumCst=0.00;
    poslong=0;
    posshort=0;
    for (i=1; i < BarCount; i++)
    {
    if(Buy[i])
    {
    poslong==1;
    posshort==0;
    CumCst[i]=0.10;
    }
    if(Sell[i])
    {
    poslong==0;
    posshort==1;
    CumCst[i]=0.10;
    }
     
    if(posshort)
    {
    if(C[i] < C[i-1])
    CumCst[i] = CumCst[i-1] + 0.003;
    else
    CumCst[i] = CumCst[i-1];
    }
    if(poslong)
    {
    if(C[i] > 
    C[i-1])
    CumCst[i] = CumCst[i-1] + 0.003;
    else
    CumCst[i] = CumCst[i-1];
    }
    if(CumCst[i] >= 0.13)
    CumCst[i] = 0.13;
    }
    per=19;
    Smth=2/(per+1)+CumCst;
    MovAvg=AMA(C,Smth);
    Plot(movavg,"",colorBlue,1);
    Plot(C,"",1,64);
     
    PlotShapes(Buy*shapeUpArrow,colorGreen,0,L,-20);
    PlotShapes(Sell* 
    shapeDownArrow,colorRed,0,H,-20);
    Title="cumulative value = 
    "+WriteVal(Cumcst,1.3);