Traderji.com - Discussion forum for Stocks Commodities & Forex

AmiBroker formula Language

Discuss AmiBroker formula Language at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Hello, Here is another swing trade expoloaration AFL. You can change it to suit your ...


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

Notices


Advertise Here

Reply
 
Thread Tools
Sponsored Links
  #11  
Old 3rd November 2006, 06:13 AM
Member
 
Join Date: Aug 2005
Posts: 222
Thanks: 0
Thanked 1 Time in 1 Post
saji oommen is on a distinguished road
Reputation: 31
Default Re: AmiBroker formula Language

Hello,

Here is another swing trade expoloaration AFL. You can change it to suit your requirements


// SWING Trader//

fi = V * (C - Ref(C, -1));

BuySIG1 = IIf ( ( ( fi - MA( fi, 13 )) >= 0 ), 1, 0 );
BuySIG2 = IIf ( ( ( fi - MA( fi, 3 )) <= 0 ), 1, 0 );

SellSIG1 = IIf ( ( ( fi - MA( fi, 13 )) <= 0 ), 1, 0 );
SellSIG2 = IIf ( ( ( fi - MA( fi, 3 )) >= 0 ), 1, 0 );

Buy = Cross((EMA(Close,15)),(EMA(Close,50)))AND Cross( MACD( 12, 26 ),
Signal( 12, 26, 9 ) )AND Cross(PDI (14), MDI(14)) AND BuySIG1 OR BuySIG2;
Sell = Cross( Signal(12, 26, 9), MACD(12,26) )AND Cross( Signal(12,
26, 9), MACD(12,26) ) AND Cross(MDI (14), PDI(14))AND SellSIG1 OR
SellSIG2;
Filter = C <10 AND C >2 AND Volume > 100000 AND C> Ref(C,-1)AND (PDI
(14)>MDI(14));

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Result = WriteIf(Buy,"Buy","Sell");
AddTextColumn(Result,"Trade",
formatChar,IIf(Buy,colorDarkGreen,colorRed ),
IIf(Sell,colorPink,colorLime));
AddColumn( Close, "Close", 1.2, IIf( ROC(C, 1 ) >= 0,
colorDarkGreen,colorRed ),50 );
AddColumn(Ref(Close,-1),"Y-Close",1.2, IIf(
ROC(Ref(C,-1),1)>=0,colorDarkGreen, colorRed ),50 );
AddColumn( Volume, "Volume", 10.0, IIf( ROC(V, 1 ) >=
0,colorDarkGreen, colorRed ) );
AddColumn( ROC( Close, 1 ), "ROC(1)", 1.2, IIf( ROC(C, 1 ) >=
0,colorDarkGreen, colorRed));
AddColumn( fi, "FORCE IDX", 2.0, colorDarkBlue,37 );


Regards

Saji
Reply With Quote
Sponsored Links
  #12  
Old 3rd November 2006, 11:38 PM
Member
 
Join Date: Nov 2005
Location: Trichur,Kerala
Posts: 111
Thanks: 0
Thanked 13 Times in 5 Posts
Niranjanam is on a distinguished road
Reputation: 33
Default Re: AmiBroker formula Language

Hi Siva and Saji,

Thank you very much for your quick response.
Both the codes are working well.

Condition of W%R < -80 was based on the attached article.Actually it is for market timing and not for individual stock

I thought if a stock which is trending upwards starts falling for more than 5 days in a row it can be a sell off.

Regards
Niranjanam.
Attached Files
File Type: doc Williams.doc (53.0 KB, 195 views)
Reply With Quote
  #13  
Old 4th November 2006, 12:38 PM
rpc rpc is offline
Member
 
Join Date: Aug 2005
Posts: 358
Thanks: 3
Thanked 0 Times in 0 Posts
rpc is on a distinguished road
Reputation: 21
Default Re: AmiBroker formula Language

hi Saji
When I tried to run your afl code I got error "Error 29.
Variable 'fi' used without having been initialized.".Pls advice
rpc
Reply With Quote
  #14  
Old 4th November 2006, 02:20 PM
Member
 
Join Date: Aug 2005
Posts: 222
Thanks: 0
Thanked 1 Time in 1 Post
saji oommen is on a distinguished road
Reputation: 31
Default Re: AmiBroker formula Language

Hello,

I rechecked the AFL. it is working for me. Make sure you have copied and pasted the full AFL. If not add this line also to initialize fi.

fi = V * (C - Ref(C, -1));

Remember this is an exploration only.

Regards

Saji
Reply With Quote
  #15  
Old 4th November 2006, 07:13 PM
rpc rpc is offline
Member
 
Join Date: Aug 2005
Posts: 358
Thanks: 3
Thanked 0 Times in 0 Posts
rpc is on a distinguished road
Reputation: 21
Default Re: AmiBroker formula Language

hi saji
Being new to AB I do not know if I have done it right .Here is what I did.I copied the whole "formula"( including the lined you have mentioned and which already exist in your formula) in a file called "swing2.afl" and put the file in \formula\custom directory this showed the formula under custom folder in AB and I just rt clicked and selected "Insert".Pls guide me if I have done smthg wrong.Also pls explain the difference between exploration and formula.
TIA
rpc
Reply With Quote
  #16  
Old 4th November 2006, 08:54 PM
Member
 
Join Date: Aug 2005
Posts: 222
Thanks: 0
Thanked 1 Time in 1 Post
saji oommen is on a distinguished road
Reputation: 31
Default Re: AmiBroker formula Language

Hello,

Try this out. Open Ami. Go to Analysis ,formula editor. Paste the full formula in the editor space. You will see the AFL as unnamed with a number. Now clicK on the AFL button with a tick mark to ensure that the formula you have copied is free of errors. Now if there are no errors use save as button to save the formula as AFL , say swing trade AFL in any folder you choose.

Now again go to Analysis, click on Automatic Analysis. It will open the page where you may select the saved AFL from the folder you have saved and press the explore button to start the exploration. Select all symbols and dates.Please go through the help file of AMI. All you have to do is press F1 button.

Of course this is a crude method. when you are familiar with AMI you can use the other methods.

Regards

Saji
Reply With Quote
  #17  
Old 5th November 2006, 01:02 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 914
Thanks: 0
Thanked 33 Times in 3 Posts
bvpraveen will become famous soon enough
Reputation: 65
Default AFL for importing NSE Bhavcopy

Hi Friends,

----------------------------------------------------------------------------
The updated version of this AFL is available at http://www.traderji.com/64268-post35.html
----------------------------------------------------------------------------

Please find the attached AFL for converting NSE Bhavcopy to filtered copy, that can be imported into Amibroker.

The steps for using the AFL is given in the AFL itself. I've taken into account only EQ and BE sections. We can customize to our needs.

Please let me know, if it needs any improvement.

Thanks,
Praveen.
Attached Files
File Type: txt Import NSE Bhavcopy.txt (1.7 KB, 178 views)

Last edited by bvpraveen; 10th November 2006 at 09:00 AM. Reason: Updated the links
Reply With Quote
  #18  
Old 6th November 2006, 11:02 AM
rpc rpc is offline
Member
 
Join Date: Aug 2005
Posts: 358
Thanks: 3
Thanked 0 Times in 0 Posts
rpc is on a distinguished road
Reputation: 21
Default Re: AmiBroker formula Language

hi Saji
Thanks for the explanation.I will try it and let you know the result
rpc
Reply With Quote
  #19  
Old 6th November 2006, 12:07 PM
Member
 
Join Date: Sep 2005
Location: hyderaabd
Posts: 777
Thanks: 20
Thanked 25 Times in 11 Posts
murthymsr will become famous soon enough
Reputation: 52
Default Re: AFL for importing NSE Bhavcopy

Quote:
Originally Posted by bvpraveen View Post
Hi Friends,

Please find the attached AFL for converting NSE Bhavcopy to filtered copy, that can be imported into Amibroker.

The steps for using the AFL is given in the AFL itself. I've taken into account only EQ and BE sections. We can customize to our needs.

Please let me know, if it needs any improvement.

Thanks,
Praveen.
a great idea, my friend, praveen, to make AB to fetch its own data, dispensing with many convertor's available around. i feel it needs a bit of backward integration and incorporation of some user convenience.

1) the NSE cash market bhav copy is savable as a csv file in the format:
cm03NOV2006bhav.csv. you may use the same file naming format to the source file. this will avoid the trouble of renaming the file while saving to the AFL desired format.

the corresponding destination file name could be:
cm03NOV2006.csv, in a different directory to make identifiacation easy for the user. this will be more relevant when other segments also are added.

you may also give the option to user to retain/delete the source file after convertion.

2) the AFL may on it's own generate the file name from the current date & present it as a default, so that life becomes easier for the user.

3) similar AFL's may be generated for FnO segment also after release of the final version after considering all user opinions/requests, if any.

not withstanding above comments, it's firstly a NEW concept and deserves a pat. congratulations.

all the best.
murthymsr
Reply With Quote
  #20  
Old 6th November 2006, 12:34 PM
Member
 
Join Date: Aug 2005
Posts: 222
Thanks: 0
Thanked 1 Time in 1 Post
saji oommen is on a distinguished road
Reputation: 31
Default Re: AmiBroker formula Language

Hello Praveen,

What you have done is excellent and very useful. You may also try and incorporate changes suggested by Mr. Murthy.

Regards

Saji
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: AmiBroker formula Language
Thread Thread Starter Forum Replies Last Post
need help on formula cmlee MetaStock 23 8th October 2007 07:55 PM
Metastock ,Metatrader & Amibroker indicator formula saji oommen MetaStock 0 4th June 2006 06:35 PM
Metastock language help Ropewalker MetaStock 4 1st November 2005 09:16 PM
TradeStation & MetaStock Formula Language bikertrader MetaStock 4 10th December 2004 01:50 PM


All times are GMT +5.5. The time now is 11:50 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