[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] conditional text in explorations



PureBytes Links

Trading Reference Links

Davem,

Maybe this can help you.

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:

//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");

Anthony

----- Original Message ----- 
From: "Dave Merrill" <dmerrill@xxxxxxx>
To: "AmiBroker" <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, September 17, 2003 5:29 PM
Subject: [amibroker] conditional text in explorations


> is there any way to have conditional text in an exploration? looking for
the
> equivalent of  this:
> IIf(condition, TrueText, FalseText)
>
> the solution looked like WriteIf, but I need it to evaluate for each
> exploration line, and it doesn't, I think.
>
> this is from Tomasz, in the list archive:
> ----------------------
> WriteIF in exploration gives ALWAYS the "last value" - the value of the
> field on the last
> bar of analysis periods.
>
> WriteIF in commentary gives always selected value.
>
> In both cases single string is returned (not array of strings)
> ----------------------
>
> is there any way to do this?
>
> Dave Merrill
>
>
>
> 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/
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Remanufactured Ink Cartridges & Refill Kits at MyInks.com for: HP $8-20. Epson $3-9, Canon $5-15, Lexmark $4-17. Free s/h over $50 (US & Canada).
http://www.c1tracking.com/l.asp?cid=6351
http://us.click.yahoo.com/0zJuRD/6CvGAA/qnsNAA/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/