Traderji.com - Discussion forum for Stocks Commodities & Forex

how to do this in AB ?

Discuss how to do this in AB ? at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Hi guys, I have been trying to work on my system and the problem I ...


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

Notices


Advertise Here

Reply
 
Thread Tools
Sponsored Links
  #1  
Old 13th August 2007, 03:45 PM
Member
 
Join Date: May 2007
Posts: 30
Thanks: 0
Thanked 2 Times in 1 Post
ra303 is on a distinguished road
Reputation: 22
Default how to do this in AB ?

Hi guys, I have been trying to work on my system and the problem I face is that not all the indicators give a signal at the same time. So Stoch might have crossed a couple of days back but MACD only crossed its signal line today and ADX might cross tomorrow.

So in short how do I check if an indicator gave a positive signal in the last 7 days and another gave today and check for it in the BUY rule. thanx a lot.
Reply With Quote
Sponsored Links
  #2  
Old 13th August 2007, 05:43 PM
Member
 
Join Date: Sep 2005
Posts: 1,097
Blog Entries: 1
Thanks: 9
Thanked 29 Times in 18 Posts
beginner_av will become famous soon enoughbeginner_av will become famous soon enough
Reputation: 111
Default Re: how to do this in AB ?

if you are using AA, just increase you n last days to 7. Since your question is too newbie like, I assume you are new to AB, so I am not going into the AFL part.
Reply With Quote
  #3  
Old 13th August 2007, 07:35 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 913
Thanks: 0
Thanked 33 Times in 3 Posts
bvpraveen will become famous soon enough
Reputation: 65
Default Re: how to do this in AB ?

Quote:
Originally Posted by ra303 View Post
Hi guys, I have been trying to work on my system and the problem I face is that not all the indicators give a signal at the same time. So Stoch might have crossed a couple of days back but MACD only crossed its signal line today and ADX might cross tomorrow.

So in short how do I check if an indicator gave a positive signal in the last 7 days and another gave today and check for it in the BUY rule. thanx a lot.
Hi,

You can use ValueWhen() clubbed together with DateNum() to achieve what you are looking for.

This is not possible without an AFL.

Praveen.
Reply With Quote
  #4  
Old 14th August 2007, 05:45 AM
Member
 
Join Date: May 2007
Posts: 30
Thanks: 0
Thanked 2 Times in 1 Post
ra303 is on a distinguished road
Reputation: 22
Default Re: how to do this in AB ?

thanx for the replies guys. I am happy to do AFL coding, although not an expert.

I was wondering if I can use BarsSince ? like
Code:
BUY = BarsSince(ADXBuy) <= 7;
where ADXBuy would have given the signal a few days back ?

With ValueWhen() and DateNum() can you give a small example ? it will help me get on my way. thanx.
Reply With Quote
  #5  
Old 14th August 2007, 09:24 AM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 913
Thanks: 0
Thanked 33 Times in 3 Posts
bvpraveen will become famous soon enough
Reputation: 65
Default Re: how to do this in AB ?

Quote:
Originally Posted by ra303 View Post
thanx for the replies guys. I am happy to do AFL coding, although not an expert.

I was wondering if I can use BarsSince ? like
Code:
BUY = BarsSince(ADXBuy) <= 7;
where ADXBuy would have given the signal a few days back ?

With ValueWhen() and DateNum() can you give a small example ? it will help me get on my way. thanx.
Yes, BarsSince should solve the problem.

Its much simpler than using ValueWhen and DateNum. What I thought was to use ValueWhen to get the last day we got the buy signal. And then compare it with DateNum of current day. As you can see, BarsSince provides this functionality at one shot.

Praveen.
Reply With Quote
  #6  
Old 22nd August 2007, 03:26 PM
Member
 
Join Date: Oct 2006
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
coolblue is on a distinguished road
Reputation: 20
Default Re: how to do this in AB ?

I would like to sort scans results by time. But Amibroker seems to sort them
by date only. Could someone let me know how to sort by time?
Reply With Quote
  #7  
Old 22nd August 2007, 03:54 PM
Member
 
Join Date: May 2006
Location: Kolkata
Posts: 1,098
Thanks: 1
Thanked 1 Time in 1 Post
swagat86 is on a distinguished road
Reputation: 25
Default Re: how to do this in AB ?

Quote:
Originally Posted by coolblue View Post
I would like to sort scans results by time. But Amibroker seems to sort them
by date only. Could someone let me know how to sort by time?
copy it in excel
and use "Sort"



thanks
Reply With Quote
  #8  
Old 22nd August 2007, 05:47 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 913
Thanks: 0
Thanked 33 Times in 3 Posts
bvpraveen will become famous soon enough
Reputation: 65
Default Re: how to do this in AB ?

Quote:
Originally Posted by coolblue View Post
I would like to sort scans results by time. But Amibroker seems to sort them
by date only. Could someone let me know how to sort by time?
Simple. Use SetSortColumns() to set the column number to sort.

For eg. if your Scan output is in the format: Ticker, Date, Trade,etc, use SetSortColumns(3);

It takes the column number, the index of which starts from 1. Give negative number to mean descending order. ie SetSortColumns(-3); would sort the results, in this example, in datetime descending order.

Praveen.
Reply With Quote
  #9  
Old 22nd August 2007, 06:52 PM
Member
 
Join Date: Oct 2006
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
coolblue is on a distinguished road
Reputation: 20
Default Re: how to do this in AB ?

Swagat and Praveen

Thanks for the response.

When i try to sort the scan results manually I am able to sort by clicking on the column header for all the other parameters like ticker, trade, price etc. When I try to sort the datetime column it automatically sorts by date only and fails to take time into account. This becomes painful when your are running intraday scans.

Praveen as you said I would be able automate the scan process by using the setsortcolumn.

But I also need the scan to be sorted datetime wise so that the last results are displayed
on top. Is there a solution for this. Please suggest (My guess is the format of the datetime field must be properly set. How to do this? )

Thanks
Reply With Quote
  #10  
Old 22nd August 2007, 09:01 PM
Member
 
Join Date: May 2006
Location: Bangalore
Posts: 913
Thanks: 0
Thanked 33 Times in 3 Posts
bvpraveen will become famous soon enough
Reputation: 65
Default Re: how to do this in AB ?

Hi,

As I'd said SetSortColumns() solves your problem. It takes care of time too.
Please refer to the screen shot attached.

Note both the AA output, as well as the AFL at the background.

Praveen.
Attached Images
File Type: png SetSortColumns.PNG (85.6 KB, 43 views)
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


All times are GMT +5.5. The time now is 02:41 PM.

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