Array size of each candle/bar in amibroker ? with working C code

Discussion in 'Trading Software' started by fxtraders, Oct 24, 2016.

  1. As you might know, amibroker is similar to C .. that's what I've been told ..

    Below C code that count number of digits.
    C program that count size of array. 2 to <10 . .array size: 8
    I've no idea , how to do it in amibroker ?even though it's similar to C , belowcode
    is C program

    Code:
    #include <stdio.h>
        int main(){
        long n;
        int count = 0;
        int m[10],i;
    
        for( i = 2; i < 10 ; i++ )
        {
            n /= 10;
            ++count;
            m[i]=i+1;
            printf("m[%d]= %d\n",i+1,m[i]);
    
        }
    
        printf("Counting number of digits: %d", count);
        }
    
    

    Output(click on link): https://ideone.com/fP2boO

    Below code need to be correct:
    Solution suggested by X person:
    You have to sum via VarSet/VarGet. That one is done in the nested loop. Then the result is called in second loop

    Code:
    
    
    SetBarsRequired(-2,-2);
    Plot( C, ""+Interval(2), styleCandle );
    for( i = 1; i <4 ; i++ )
    {
       TimeFrameSet(i*in1Minute );
       rs = RSI(14);
       TimeFrameRestore();
       VarSet( "M"+ i, TimeFrameExpand( rs, i*in1Minute , expandPoint ) );
    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() );SetBarsRequired(-2,-2);
    
    
    /*
    shape2 = 0;
    shape3 = 0;
    for( b = 0; b < BarCount; b++) {// visible chart area loop
       
    getvar = ....;
        switch( getvar  ) {
            case 2: ....
       
            case 3: ....
    
                default: break;
        }                   
    }       
    
    PlotShapes( shape2 * shapeSmallCircle, colorWhite, 0, L, n*-35 );
    PlotShapes( shape3 * shapeSmallCircle, colorYellow, 0, L, n*-35 );
    
    
    [​IMG]

    NEED OUTPUT LIKE UPPER PICTURE..

    3x means 3 times ..
    2x means 2 times ..
    Yes , i haven't written all 2x and 3x ..

    What do i need to add to make it work like upper picture?
     
    Last edited: Oct 24, 2016