trying to do AFL coding....Help please.

Discuss trying to do AFL coding....Help please. at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Hi everyone, been hee for a few days and the amount of information and wisdom ...


Go Back   Traderji.com - Discussion forum for Stocks Commodities & Forex > TOOLS & RESOURCES > Software > AmiBroker

Notices


Reply
 
Thread Tools
Sponsored Links
  #1  
Old 5th June 2007, 11:20 AM
Member
 
Join Date: May 2007
Posts: 30
ra303 is on a distinguished road
Default trying to do AFL coding....Help please.



Hi everyone, been hee for a few days and the amount of information and wisdom on this forum is great...

Now I have been trying to program the following rules into Amibroker so that I can scan for stocks.

1. higher than 5 days volume
2. Aroon higher than 50
3. ADX higher than 30
4. RSI14 higher than 60

I am new to AFL so any help would be greately appreciated.

Raj.
Reply With Quote
  #2  
Old 5th June 2007, 12:40 PM
Member
 
Join Date: May 2006
Location: Kolkata
Posts: 1,102
swagat86 is on a distinguished road
Default Re: trying to do AFL coding....Help please.

Quote:
Originally Posted by ra303 View Post
Hi everyone, been hee for a few days and the amount of information and wisdom on this forum is great...

Now I have been trying to program the following rules into Amibroker so that I can scan for stocks.

1. higher than 5 days volume
2. Aroon higher than 50
3. ADX higher than 30
4. RSI14 higher than 60

I am new to AFL so any help would be greately appreciated.

Raj.
volume
/* Create date: 05 Jun 2007
The Volume of the current bar is greater than the Volume (Average) of 1 bar ago */

Filter = Volume > Ref( MA( Volume, 5 ), -1 );
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );


adx

/* Create date: 05 Jun 2007
The ADX of the current bar is greater than 30 */

Filter = ADX( 14 ) > 30;
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );


Rsi

/* Create date: 05 Jun 2007
The RSI of the current bar is greater than 60 */

Filter = RSIa( Close, 14 ) > 60;
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );

aroon i have no idea abt.


thanks
Reply With Quote
  #3  
Old 5th June 2007, 01:51 PM
Member
 
Join Date: May 2007
Posts: 30
ra303 is on a distinguished road
Default Re: trying to do AFL coding....Help please.

Hi Swagat, thanx a lot for your time and effort. I got 2 syntax error:

Error31. Syntax error, expecting '('

Filter = ADX( 14 ) > 30;
Filter = RSIa(Close, 14 ) > 60;

I thought we could use something like this one:

Filter = RSI(14) > 60

ADX(14) > 30 ;

and at the end do something like this to only list stocks that qualify all the conditions:

Filter = RSI(14) > 60 AND ADX(14) > 0 AND Volume > Ref( MA( Volume, 5 ), -1 );
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );
Reply With Quote
  #4  
Old 5th June 2007, 01:55 PM
Member
 
Join Date: May 2007
Posts: 30
ra303 is on a distinguished road
Default Re: trying to do AFL coding....Help please.

ok I have got it this close, but getting an error at the last line. I think its the "Aroon_Osc" > 30; bit that is not right.

Also, if I wanna add Buy/Sell to it, what would be a good way to do it ?

thanx a lot for your help, and hope somebody is able to fix it for me. This is really interesting.

Code:
//****************************************************************************************
// My Exploration - Ver 4
// ***************************************************************************************

/* Create date: 05 Jun 2007

The Volume of the current bar is greater than the Volume (Average) of 1 bar ago */

Filter = Volume > Ref( MA( Volume, 2 ), -1 );

//The ADX of the current bar is greater than 20 */

Filter = ADX( 14 ) > 20;

//The RSI of the current bar is greater than 50 */

Filter = RSIa( Close, 14 ) > 50;

// Exploration in Aroon 
Period = 14;
LLVBarsSince = LLVBars(L, Period) + 1;
HHVBarsSince = HHVBars(H, Period) + 1;

Aroon_Down = 100 * (Period - LLVBarsSince) / (Period - 1);
Aroon_Up   = 100 * (Period - HHVBarsSince) / (Period - 1);
Aroon_Osc  = Aroon_Up - Aroon_Down;

AddColumn(Aroon_Osc,    "Aroon_Osc",    format=1.2);
AddColumn( Close, "Close " );
AddColumn( Open, "Open " );
AddColumn( High, "High " );
AddColumn( Low, "Low " );
AddColumn( Volume, "Volume " );

Filter = RSIa( Close, 14 ) > 60 AND ADX(14) > 30 AND Volume > Ref( MA( Volume, 5 ), -1 ); AND "Aroon_Osc" > 30;

Last edited by ra303; 6th June 2007 at 09:13 AM.
Reply With Quote
  #5  
Old 6th June 2007, 11:34 AM
Member
 
Join Date: May 2007
Posts: 30
ra303 is on a distinguished road
Default Re: trying to do AFL coding....Help please.

someone ?? Help Please....
Reply With Quote
  #6  
Old 6th June 2007, 12:50 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 914
bvpraveen is on a distinguished road
Default Re: trying to do AFL coding....Help please.

Quote:
ok I have got it this close, but getting an error at the last line. I think its the "Aroon_Osc" > 30; bit that is not right.
1. There is a typo in the last statement. Remove the extra semi-colon and remove the doube quotes in Aroon_Osc. Here is the updated Filter statement:

Filter = RSIa( Close, 14 ) > 60 AND ADX(14) > 30 AND Volume > Ref( MA( Volume, 5 ), -1 ) AND Aroon_Osc > 30;

2. Assign the Filter variable just once. Assigning more than once is not logical. The usage of Filter in your last statement is correct - ie using AND, OR, etc...

Quote:
Also, if I wanna add Buy/Sell to it, what would be a good way to do it ?
I don't know what your formula does. I think the Filter condition is itself Buy signal. So

Buy = Filter;

will suffice for Buy signals. Similarly code for Sell signal.

Please look at some sample AFLs, or templates(which i'd posted some time back), for getting Buy and Sell signals on charts(with arrows, etc)

Get back to us for any clarifications.

Praveen.
Reply With Quote
  #7  
Old 6th June 2007, 02:57 PM
Member
 
Join Date: Nov 2006
Posts: 201
alpha1 is on a distinguished road
Default Re: trying to do AFL coding....Help please.

I need help on making indicators for weekly prices.

eg If today is thursiday, and the closing EOD is 111, and last week friday the opening was 91. That is opening on (n-4)th day and closing on nth day

I need these data for all days.

And then use it for indicators.


How to do it?
Reply With Quote
  #8  
Old 6th June 2007, 03:03 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 914
bvpraveen is on a distinguished road
Default Re: trying to do AFL coding....Help please.

Quote:
Originally Posted by alpha1 View Post
I need help on making indicators for weekly prices.

eg If today is thursiday, and the closing EOD is 111, and last week friday the opening was 91. That is opening on (n-4)th day and closing on nth day

I need these data for all days.

And then use it for indicators.


How to do it?
Try Ref(). See Amibroker User Guide for details about Ref().

Praveen.
Reply With Quote
Sponsored Links


Reply

Bookmarks


Advertise Here


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads for: trying to do AFL coding....Help please.
Thread Thread Starter Forum Replies Last Post
Better coding in metastock oxusmorouz MetaStock 0 7th February 2007 07:56 AM
WSA : Help in coding younggenius Technical Analysis 0 27th April 2005 05:50 PM


All times are GMT +5.5. The time now is 02:46 AM.

Indemnity, Disclaimer & Disclosure Notice:
• By visiting Traderji.com you indicate your acceptance of our Forum Rules Disclaimer & Disclosure and indemnify Traderji.com, its associates and related parties of all claims howsoever resulting from the usage of the forum.
Disclaimer: Trading or investing in stocks & commodities is a high risk activity. Any action you choose to take in the markets is totally your own responsibility. Traderji.com will not be liable for any, direct or indirect, consequential or incidental damages or loss arising out of the use of this information.
Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein. The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy of information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.
 


Copyright © 2001 - 2008, Traderji.com All Rights Reserved.

Recommended Websites - www.TradersEdgeIndia.com - www.TradingPicks.com - www.MasterOfTrading.com