NexusFi: Find Your Edge


Home Menu

 





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


Discussion in Platforms and Indicators

Updated
    1. trending_up 2,047 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

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

  #1 (permalink)
fxtraders
connaught, DL
 
Posts: 11 since Sep 2016
Thanks Given: 1
Thanks Received: 0

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

Below C code 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 get 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
or
you store the increment calculation to a table (either via varset/varget or matrix).
Then that table can be called from outside your nested 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 );


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?

Reply With Quote




Last Updated on October 24, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts