PureBytes Links
Trading Reference Links
|
Mark,
Try this in AA...click explore
//Sample trading system
Buy=Cross(C,MA(C,28));
Sell=Cross(MA(C,28),C);
Short=Sell;
Cover=Buy;
/**********************************/
islong=Flip(Buy,Sell);
x=BarsSince(Buy);
y=BarsSince(Sell);
Filter=1;
AddColumn(IIf(islong,76,83),"CurrentPosition", formatChar);
AddColumn(IIf(islong,x,y),"Bars");
This is in from Tomasz,
By design WriteIf always returns text corresponding to LAST VALUE.
Instead you should use +1 for long or -1 for short and regular AddColumn.
The other solution is to use single characters:
L for Long
S for Short
using ASCII codes of L (76) and S (83) letters and formatChar:
Hope this helps.
Anthony
-------Original Message-------
From: amibroker@xxxxxxxxxxxxxxx
Date: Thursday, May 15, 2003 11:01:28 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Exploration Question
Anthony- Thanks, but for some reason WriteIf only returns the last
value of the exploration as opposed to bar-by-bar values, so I'm
trying to do this with numbers and then convert them to text once in
Excel. I've found that this is more complicated than it originally
seemed. For example, some asymmetric systems may have buy and sell
signals that overlap for several bars, so it comes down to the order
of the signals. I'm using all this as a reason to finally learn how
to code loops. Thanks again for having a go at it.
Mark
--- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@xxxx>
wrote:
> Mark,
>
> Try this in AA....click explore
>
> //Sample trading system
>
> Buy=Cross(C,MA(C,28));
> Sell=Cross(MA(C,28),C);
>
> /**********************************/
> islong=Flip(Buy,Sell);
> x=BarsSince(Buy);
> y=BarsSince(Sell);
> Filter=1;
> AddTextColumn(WriteIf(islong,"LONG","SELL"),"CurrentPosition");
> AddColumn(IIf(islong,x,y),"Bars");
>
> Anthony
> -------Original Message-------
>
> From: amibroker@xxxxxxxxxxxxxxx
> Date: Monday, May 12, 2003 10:25:52 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Exploration Question
>
> Hi Everyone,
>
> Is there any way to add a column of text to an exploration that
> indicates trade status? Specifically, I need to add a column that
> specifies "Long" or "Short" (depending on which is the case) beginning
> with the bar of entry, through and including the bar before the bar of
> exit, then "Out" beginning with the exit bar and continuing for all
> bars the system's not in the market, etc. I understand I need to use
> Filter=1 to ensure no bars are missed. Thanks. Mark
>
>
> Yahoo! Groups Sponsor
>
>
>
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq
> html
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|