Function for counting something in amibroker?

Discussion in 'Trading Software' started by fxtraders, Sep 25, 2016.

  1. Hi,

    What function do you for counting some stuff in amibroker??

    Sum() and Cum() do not count, are they ?

    Sum() and Cum() use for addition, what do we use for counting ?
     
  2. Metamega

    Metamega

    They can be used for counting.

    If a statement is true it returns value 1, if false it returns 0.

    Guess it all depends on what your counting.
     
    fxtraders likes this.
  3. Hi,

    [​IMG]
    I wanted to count numbers such as under candle.

    Code:
    Plot( C, ""+Interval(2), styleCandle );
    for( i = 1; i <4 ; i++ )
    {
    VarSet( "M" + i,  i);
    M = VarGet( "M" + i );
    
       for( b = 0; b < BarCount; b++ )
        {
    if(M[b] )   PlotText(" "+(i), b, L[b]-1-(i), colorAqua);
    }
    }
    Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
    
    If i want to count those numbers , What should i write ?
    if(Sum([m]))PlotShapes( shapeCircle*m , colorGreen, 0, H, 45 ); ?
     
    Last edited: Sep 25, 2016