PureBytes Links
Trading Reference Links
|
Thanks for looking at it, luckily it was large
enough for TJ to see and he fixed it right away. At least I chose the right
function for the task, I just failed to implement it properly. Ron
D
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Bob Jagow
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, September 18, 2003 9:36
PM
Subject: RE: [amibroker] Problem with
Exploration
Wish
I could help, Ron, but your text was too small to
read.
<FONT face=Arial color=#0000ff
size=6>Bob
<FONT face=Tahoma
size=2>-----Original Message-----From: mrdavis9
[mailto:mrdavis9@xxxxxxxxxx]Sent: Thursday, September 18, 2003
3:01 PMTo: amibrokeryahoogroupsSubject: [amibroker]
Problem with Exploration
This is a resend. According to what I read in
the user manual, the method that I used to add these
four additional report colums to my Exploration should have worked. I
would sure appreciate receiving the correct code lines that will make my
four additional columns work. I have investigated every AFL function
that bears a name that is at all related. I chose to use DateTime()
because it reads like it is made to do exactly what I want to do,
but I can't make it work. All help appreciated. Ron D
SYNTAX
DateTime()
RETURNS
ARRAY
FUNCTION
Returns array of encoded date/time values suitable for
using with AddColumn and formatDateTime constant to produce date time
formated according to your system settings.
EXAMPLE
1. Simple date/time column
AddColumn( DateTime(), "Date / Time", formatDateTime );
2. Example (produces signal file accepted by various other
programs):
Buy=Cross(MACD(),Signal());Sell=Cross(Signal(),
MACD());Filter=Buy OR Sell;SetOption("NoDefaultColumns", True
);AddColumn( DateTime(), "Date", formatDateTime );AddColumn(
IIf( Buy, 66, 83 ), "Signal", formatChar
);
<FONT face=Arial
size=4>========================================================================
This is the earlier email.
This post superscedes all of my previous posts
about my adventures in developing this Exploration using daily EOD
data. The version copied directly below performs exactly as required,
thanks to all of the excellent help that I received from this
board.
This post is a description of the additional
report columns that I am trying to add this Exploration. I will try to
be abundantly clear regarding these additional features,
so you may find a few unnecessary clarifications in the rest of
this email. Hopefully, these additional features will be useful to
others in their Explorations. I have a lot of Exploring to do
on various systems that look promising based on where I am seeing the
buy and sell arrows . Thanks for any additional assistance you can offer .
Ron D
<FONT face=Arial
size=4>==========================================================
I now want to add a few more report columns that
will report the following:
GAINS TO DATE(which is the net positive or
negative amount of gains made up to that date. If the Exploration is run on
only one stock, it would obviously be the gains made on that one
stock. If the exploration is run on all stocks, then it would be the
net gain made on all the stocks, up to that date.)
DATE OF THE ACTUAL PURCHASE ( which is the open
price of the day after the buy signal was received)
DATE OF THE ACTUAL SALE ( which is the open
price of the day after the sell signal was received)
NUMBER OF DAYS IN TRADE(The days to be
included in this count start with the day the purchase was made(day #1) and
end with the day the sale was made(day#final).
<FONT face=Arial
size=4>================================================
This is the version that now works, and pasted
below here is my attempt to add the additional desired features.
FastStoch = StochK(
14 );
SlowStoch = StochD(
14 );
Buy = Cross(
FastStoch, SlowStoch );
Sell = Cross(
SlowStoch, FastStoch );
StochKBuy = ValueWhen<FONT
size=1>( Buy, FastStoch );
StochKSell = ValueWhen<FONT
size=1>( Sell, FastStoch );
StochKDiff = StochKSell - StochKBuy;
EPrice = ValueWhen(
Ref(
Buy,-1),
Open );
XPrice = ValueWhen(
Ref(
Sell,-1),
Open );
Rtn = XPrice - EPrice;
PctRtn = Rtn / EPrice * 100<FONT
size=1>;
Filter = C > <FONT color=#ff00ff
size=1>1 AND C < <FONT
color=#ff00ff size=1>100 AND V >
100000;
AddColumn(
StochKBuy, "Buy Value"<FONT
size=1>, 1.2
);
AddColumn( StochKSell, <FONT color=#ff00ff
size=1>"Sell Value", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( StochKDiff, <FONT color=#ff00ff
size=1>"%K Diff", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( EPrice, <FONT color=#ff00ff
size=1>"Entry $", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( XPrice, <FONT color=#ff00ff
size=1>"Exit $", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( Rtn, "$
Rtn", 1.2<FONT
size=1> );
AddColumn( PctRtn, <FONT color=#ff00ff
size=1>"% Rtn", <FONT color=#ff00ff
size=1>1.2 );
<FONT
size=1>======================================================================================================
This is my attempt to add the additional features. I
commented out various additions of mine till this worked, but this commented
version does not show any buy arrows.
FastStoch = StochK(
14 );
SlowStoch = StochD(
14 );
Buy = Cross(
FastStoch, SlowStoch );
Sell = Cross(
SlowStoch, FastStoch );
StochKBuy = ValueWhen<FONT
size=1>( Buy, FastStoch );
StochKSell = ValueWhen<FONT
size=1>( Sell, FastStoch );
StochKDiff = StochKSell - StochKBuy;
EPrice = ValueWhen(
Ref(
Buy,-<FONT
color=#ff00ff size=1>1), Open );
XPrice = ValueWhen(
Ref(
Sell,-<FONT
color=#ff00ff size=1>1), Open );<FONT
face="Courier New" size=1>
GainPerTrade = XPrice - EPrice;
PctRtn = GainPerTrade <FONT
size=1>/ EPrice * 100<FONT
size=1>;
GainsToDate =<FONT face="Courier New" color=#0000ff
size=1>Sum(GainPerTrade,<FONT
face="Courier New" color=#0000ff size=1>BarsSince<FONT
face="Courier New" size=1>(GainPerTrade));
////////////////////////////////////////////////////////DayOfBuySignal=DateTime(Buy);
////////////////////////////////////////////////////////<FONT
color=#008000 size=1>DayOf<FONT face="Courier New" color=#008000
size=1>SellSignal=DateTime(<FONT
face="Courier New" color=#008000 size=1>Sell<FONT color=#008000
size=1>);
////////////////////////////////////////////////////////<FONT
color=#008000 size=1>DaysBetweenSignals<FONT face="Courier New"
color=#008000 size=1>=<FONT color=#008000
size=1>DateTime(Sell)<FONT face="Courier New" color=#008000
size=1>-DateTime(Buy);<FONT
size=1>
Filter = C > <FONT color=#ff00ff
size=1>1 AND C < <FONT
color=#ff00ff size=1>100 AND V >
100000<FONT face="Courier New"
size=1> AND Buy OR Sell<FONT
size=1>;
SetOption(<FONT color=#ff00ff
size=1>"NoDefaultColumns", True
);
AddColumn( StochKBuy, <FONT color=#ff00ff
size=1>"Buy Value", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( StochKSell, <FONT color=#ff00ff
size=1>"Sell Value", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( StochKDiff, <FONT color=#ff00ff
size=1>"%K Diff", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( EPrice, <FONT color=#ff00ff
size=1>"Entry $", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( XPrice, <FONT color=#ff00ff
size=1>"Exit $", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( GainPerTrade, <FONT color=#ff00ff
size=1>"$ Rtn", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( PctRtn, <FONT color=#ff00ff
size=1>"% Rtn", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( GainsToDate,<FONT color=#ff00ff
size=1>"$Total", <FONT color=#ff00ff
size=1>1.2 );<FONT face="Courier New"
color=#008000 size=1>
///////////////////////////////////////////<FONT color=#008000
size=1>AddColumn(DaysInTrade, "$ Rtn", 1.2 );<FONT color=#0000ff
size=1>
AddColumn( <FONT color=#0000ff
size=1>IIf( Buy, <FONT color=#ff00ff
size=1>66, <FONT color=#ff00ff
size=1>83 ), <FONT color=#ff00ff
size=1>"Signal", formatChar );<FONT
face="Courier New" color=#008000 size=1>
///////////////////////////////////////////<FONT color=#008000
size=1>AddColumn( DayOfBuySignal<FONT face="Courier New"
color=#008000 size=1>,"Eday",
formatDateTime );
///////////////////////////////////////////<FONT color=#008000
size=1>AddColumn( DayOfSellSignal, "<FONT face="Courier New"
color=#008000 size=1>Xday", formatDateTime
);
///////////////////////////////////////////<FONT color=#008000
size=1>AddColumn( DaysBetweenSignals<FONT face="Courier New"
color=#008000 size=1>,"<FONT
face="Courier New" color=#008000 size=1>DaysHeld<FONT color=#008000
size=1>", formatDateTime );
<FONT face=Arial
size=5> Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS
to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|