Australian (ASX) Stock Market Forum

Amibroker FAQ

All you need to do is:

1. Closing AmiBroker
2. Deleting Broker.Master
3. Restarting AmiBroker

It will re-build the database from stock files. First start of AB will be a little bit slower becasue of rebuilding process.

As for 64-bit vs. 32.bit plugins.
64-bit plugins don't belong to 32-bit plugins folder of Program Files (x86) because that's the directory of AB 32-bit.
Also 32-bit plugins don't work in 64-bit AB.

32-bit to 32-bit and 64-bit to 64-bit. Apples to apples and oranges to oranges.

I'm back again because I thought I had the data back but it ended at 2012. And now I restart and I'm back to 99% of symbol data missing.

Thanks for the suggestion trash. I tried deleting all Broker.Master files but no luck. All the symbols are listed, but most have no data.

The other thing is, earlier most of the stock files had 155Kb of data, now they only have 2-5Kb. I haven't deleted anything so I don't know where that data could have gone. I don't even know what question to ask!

I have deleted all instances of QT/MT plug-ins so that shouldn't be an issue, hopefully.
 
The method described re-creates the symbols only. If data was lost before then it will not re-invent data.

Are your panes back?
 
Counting loop elements are same as Array length??

a2gVoRC.png

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(Sum([m]))PlotShapes( shapeCircle*m , colorGreen, 0, H, 45 ); ?



I've found one scripts that count array,since i don't know how to use it in the first code ??

It's jscript:
Code:
EnableScript("JScript");

<%
function getArrayLength( a ) { 
	x = VBArray( a ).toArray();
	for ( y = 0; y < x.length; y += 1 ) {
		if ( x[y] == undefined ) break;
	}
	return y;
}
%>

function arrCount( arr ) {
	scr = GetScriptObject();
	a = 0;
	if ( !IsNull( BeginValue( arr ) ) ) a = scr.getArrayLength( arr );
	return a;
}

How do we use jscript to count ... when number of elements are 2.
I've tried one line code below
if(Sum([m]))PlotShapes( shapeCircle*m , colorGreen, 0, H, 45 ); ?
Of course, it's not working .



Does anyone have experience with array length ?

We're trying to plot a shape, when number of elements are two. As you can see in first picture there're 3 number of elements , you can also try when number of elements are 2 .

or Just try to plot when number of elements are three.
Yes, we are trying to count number of elements.
 
Greetings --

All arrays are the same length -- the length of the primary data series. There are BarCount elements. AmiBroker is "zero-based." The indexes of the array elements run from 0 to BarCount-1.

Best, Howard
 
Greetings --

All arrays are the same length -- the length of the primary data series. There are BarCount elements. AmiBroker is "zero-based." The indexes of the array elements run from 0 to BarCount-1.

Best, Howard

Hello howardbandy,
Greetings


I'm trying to count array length of [ for( i = 1; i <4 ; i++ ); ]
custom loop of numbers, as we are not counting number of bars

x38AqOc.png

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() );
\


In above picture ,
Number of elements are three . For counting number of elements, what code should we write?
Just in case below , i was trying to plot a shape when there're number of elements three.
if(Sum([m]))PlotShapes( shapeCircle*m , colorGreen, 0, H, 45 ); ? // This code is wrong
 

Attachments

  • x38AqOc.png
    x38AqOc.png
    32.1 KB · Views: 2
Greetings --

Referring to: "I'm trying to count array length of [ for( i = 1; i <4 ; i++ ); ]
custom loop of numbers, as we are not counting number of bars"

The emphasized line in the post asking for help was: "Does anyone have experience with array length ? "

-------------

My response was that all arrays in AmiBroker are the same length -- a statement that is true.

Whenever an array is created in an afl program, it is also that same length, and its initial element always has an index of 0.

This line of code: for( i = 1; i <4 ; i++ ); does create a sequence of 1, 2, 3 for the variable i. It is unclear from the sample code or image posted how "i" is used.

Can you post an explanation of what the code should do?

Best regards, Howard
 
Greetings --

Referring to: "I'm trying to count array length of [ for( i = 1; i <4 ; i++ ); ]
custom loop of numbers, as we are not counting number of bars"

The emphasized line in the post asking for help was: "Does anyone have experience with array length ? "

-------------

My response was that all arrays in AmiBroker are the same length -- a statement that is true.

Whenever an array is created in an afl program, it is also that same length, and its initial element always has an index of 0.

This line of code: for( i = 1; i <4 ; i++ ); does create a sequence of 1, 2, 3 for the variable i. It is unclear from the sample code or image posted how "i" is used.

Can you post an explanation of what the code should do?

Best regards, Howard

Hello howardbandy,
Greetings

Code just plot numbers under candle ..
Yes, it's doing nothing only plot number, it can be used with other stuff,
To keep question as simple as possible, i tried to use only numbers


To do (i) something , i used code below
I've just added rsi.

Code:
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() );

BMSQS55.png




(1,2) (2,3) (1,3) .. considered two number of elements



So, I've plotted a aqua shape circle when number of elements under candle is two in below picture(that's i'm trying to write in code as tried below)..as covered in pink rounded circle .. just for illustration, i plot aqua circle shape on few candles ..
if(Sum([m]))PlotShapes( shapeCircle*m , colorAqua, 0, H, 45 ); //


jqBJ5kF.png


We're trying to plot a shape, when number of elements are two.
So, what do i need to change in below line of code ??

if(Sum([m]))PlotShapes( shapeCircle*m , colorGreen, 0, H, 45 ); ?

regards
 

Attachments

  • BMSQS55.png
    BMSQS55.png
    31.5 KB · Views: 1
To sum up true MTF conditions you would have to use summing up via dynamic variables.

v7V7q6z.png

White marker plots where there is minimum of two true conditions.
 
To sum up true MTF conditions you would have to use summing up via dynamic variables.

v7V7q6z.png

White marker plots where there is minimum of two true conditions.

Hello trash,

What do i need to change ?
as (i) is loop subscript(variable), m is variable.
if(Sum([i,2]))PlotShapes( shapeCircle*m , colorAqua, 0, H, 45 );

I guess, only one line need to be changed?

regards
 
The previous post's picture is showing if minimum number is two but you want to plot when max number of true conditions is equal to two or three or four. That can be done too.

Code:
for( k = 1; k <= n; k++ ) {    // TF loop
    ....
    ......

    for( i = fvb; i <= lvb; i++ ) { // visible chart area loop
		....
    }         
}


shape2 = 0;
shape3 = 0;
for( i = fvb; i <= lvb; i++ ) {// 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 );

si3XZ6f.png
 
The previous post's picture is showing if minimum number is two but you want to plot when max number of true conditions is equal to two or three or four. That can be done too.

Code:
for( k = 1; k <= n; k++ ) {    // TF loop
    ....
    ......

    for( i = fvb; i <= lvb; i++ ) { // visible chart area loop
		....
    }         
}


shape2 = 0;
shape3 = 0;
for( i = fvb; i <= lvb; i++ ) {// 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 );

si3XZ6f.png

Hello Trash,

Code:
SetBarsRequired(-2,-2);
Plot( C, ""+Interval(2), styleCandle );
for(  i = 1; i <4 ; i++ ) {    // TF loop
       TimeFrameSet(i*in1Minute );
   rs = RSI(14);
   TimeFrameRestore();
   VarSet( "M"+ i, TimeFrameExpand( rs, i*in1Minute , expandPoint ) ); 
M = VarGet( "M" + i );

fvb = Status("FirstVisibleBar");
lvb = Status("LastVisibleBar");

    for( b = fvb; b <= lvb; b++ ) { // visible chart area loop
    if(M[b] )   PlotText(" "+(i), b, L[b]-1-(i), colorAqua);
    }         
}

/*
shape2 = 0;
shape3 = 0;
for( b = fvb; b <= lvb; b++ ) {// visible chart area loop
	getvar =  VarGet( "M" + i ); ;
	if( getvar == 2 ) {
		//if(Sum([i,2]))PlotShapes( shapeCircle*m , colorAqua, 0, H, 45 ); 
      
	}	
				
}       

PlotShapes( shape2 * shapeSmallCircle, colorWhite, 0, L, n*-35 );

Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
*/

In first part of code, it shows error: h8GOG9J.png
 
Code:
for( i = fvb; i <= lvb; i++ ) {// visible chart area loop
	getvar = ....;
	switch( getvar  ) {
	    case 2: ....
PlotShapes( shape2 * shapeSmallCircle, colorWhite, 0, L, n*-35 );


Code:
for( b = fvb; b <= lvb; b++ ) {// visible chart area loop
	getvar =  VarGet( "M" + i ); ;
	if( getvar == 2 ) {
		//if(Sum([i,2]))PlotShapes( shapeCircle*m , colorAqua, 0, H, 45 ); 
      
	}	
				
}

How do you use sum() function in it?
What do you write in getvar??
 
It shows an error because your code is wrong completely.
As for Sum.. it is an array function and it is not used the way you are applying it.
Sum is not used here anyway. You have to sum via VarSet/VarGet. That one is done in the nested loop. Then the result is called in second loop.
 
Sum is not used here anyway. You have to sum via VarSet/VarGet. That one is done in the nested loop. Then the result is called in second loop.
sum via VarSet/VarGet without using sum() function .

How you gonna do it with code?
 
Actually it is faster using matrix.
Basically you store a counter to table.

This is a standard counter where increment is 1.

Code:
cnt = 0;

for( i = 0; .... )
    cnt++;

cnt++ is equal to cnt += 1 which is equal to cnt = cnt + 1

So instead of that standard one 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.

lHxRbEJ.png
 
Code:
cnt = 0;

for( i = 0; .... )
    cnt++;
So instead of that standard one you store the increment calculation to a table (either via varset/varget or matrix).

sum via VarSet/VarGet without using sum() function .


No matrix code ? or sum via VarSet/VarGet?
 
Greetings --

Referring to: "I'm trying to count array length of [ for( i = 1; i <4 ; i++ ); ]
custom loop of numbers, as we are not counting number of bars"

The emphasized line in the post asking for help was: "Does anyone have experience with array length ? "

-------------

My response was that all arrays in AmiBroker are the same length -- a statement that is true.

Whenever an array is created in an afl program, it is also that same length, and its initial element always has an index of 0.

This line of code: for( i = 1; i <4 ; i++ ); does create a sequence of 1, 2, 3 for the variable i. It is unclear from the sample code or image posted how "i" is used.

Can you post an explanation of what the code should do?

Best regards, Howard

Hello howardbandy,

Kindly keep continue our discussion .
Code:
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() );

Upper code work in amibroker. I'm not looking for perfect code that accelerate great speed.

As we're using few lines of code to keep question as simple as possible.

I guess it will not be more than 3 lines of code.

Kindly keep continue ..


P.S. I CAN'T CHANGE X PERSON BEHAVIOUR,BUT I CAN CERTAINLY ASK TO Y PERSON.
regards
 
Top