AmiBroker formula Language

murthymsr

Well-Known Member
#31
Re: AFL for importing NSE Bhavcopy

Hello Murthy and friends,

Although the AFL is ready now, its not upto what I initially thought of. Facing some problems. Please let me know any solutions for these:
.............................
Praveen.
dear praveen,
i am sorry, as i have already told the other day during chat, i have no knowledge of C, and have no answers to your querries.

this forum is full of highly knowledgeable computer programmers, i wish, surely somebody may give the clarification needed by you.

by the way, if a solution is not coming within, you may think of presenting the revised code without the GUI interface and the related reduction of features.

all the best.
murthymsr
 
#33
Hello friends,

How to use Identifiers (O,H,L,C) or indicator's value in if(). Eg.
If(C>EMA(20))
{
statement;
statement;
}
this code gives error. I tried above by defining a numeric variable and then assign value of indicator or identifier to that variable. But after assigning identifier or indicator’s value to numeric variable “if()’ gives error. Can anybody explain why and how to solve this problem. I don’t want to use IIF.

Sudesh
 
#34
Hello friends,

How to use Identifiers (O,H,L,C) or indicator's value in if(). Eg.
If(C>EMA(20))
{
statement;
statement;
}
this code gives error. I tried above by defining a numeric variable and then assign value of indicator or identifier to that variable. But after assigning identifier or indicators value to numeric variable if() gives error. Can anybody explain why and how to solve this problem. I dont want to use IIF.

Sudesh
Hi Sudesh,

'if' conditional statement takes only boolean value and NOT array. Your code should be:

ema20 = EMA(C, 20);
for( i = 0; i < BarCount; i++ )
{
if( Close[ i ] > ema20)
statement1;
else
statement2;
}

The below code taken from Amibroker user guide will explain you in detail:


...........
Expression must be boolean ( True/False) type (so it CANNOT be ARRAY because there would be no way do decide whether to execute statement1 or not, if for example array was: [True,True,False,.....,False,True] )
..........
if( Close > Open ) // WRONG
Color = colorGreen; //statement 1
else
Color = colorRed; //statement 2

The above example is wrong, as both Open and Close are arrays and such expression as Close > Open is also an ARRAY. The solution depends on the statement. Its either possible to implement it on bar−by−bar basis, with use of FOR loop:

for( i = 0; i < BarCount; i++ )
{
if( Close[ i ] > Open[ i ] ) // CORRECT
Color[ i ] = colorGreen;
else
Color[ i ] = colorRed;
}

Let me know if i'm wrong anywhere.
Praveen.
 
#35
UPDATED AFL for importing NSE Bhavcopy

Hello Friends,

So here it is: Updated AFL for converting NSE Bhavcopy.

You can use this AFL like an indicator, just by drag and drop.
The AFL can find the source filename from the current date and do all the necessary operation automatically WITHOUT any user help. Use this option only when you do the update daily. This type of importing wont work when you import one days' Bhav copy on some other day. In this case you need to explicitly provide the source file name as explained in the AFL. This is because the AFL will AUTO DETECT the source file name based on the day when you import it.

I tried my level best to make it GUI enabled. But facing some issues with it, which i've already posted. If any one can sort it out, we can make it GUI enabled.

Please let me know if you find any problems in it or need any further improvement.

Thanks,
Praveen.
 
Last edited:
#39
nice ...please reply for this......based on these formulae given by u

http://www.traderji.com/equities/9526-tostayornottostay.html
Hello friend,

The formula is just an ordinary Bhav copy convertor, and its not used a system for trading.

If you are referring to such AFLs posted in this thread, I'm very sorry friend, honestly I've not tried them yet.

Better you take one by one, and start testing them.

All the best,
Praveen.
 
#40
Hello Friends

Can anybody guide me about how to use scanning future of AmiBroker?
If I want to scan list of stocks matching following conditions:

1. ADX is >30 and rising
2. Last bar was streddling 20EMA ie. H>20EMA>L
2. Close > previous close and L > 20EMA

Sudesh
 

Similar threads