PureBytes Links
Trading Reference Links
|
Steve, Graham, and all, thanks for your great
help. I haven't yet tried to get my creaky mind to fully
understand this current iteration (pasted below) of my first exploration.
I have added three more columns that are supposed to show the entry day, exit
day, and the number of days in the trade. When I run it, it
shows that all exits occur on the same day as the entry. This (days in
trade problem ) is most likely due to incorrect coding that I used to find
these values.
This basic concept of buying and selling
on the open is to be used for an EOD trading system that is based entirely
on buying and selling unconditionally on the open price of the day following the
buy and sell signals. These stochk crosses are not the actual system, but they
are a great thing to use in order for me to learn to do explorations that are
designed to work just like the ultimate trading system will work.
In an effort to increase my AFL knowledge, I'd like
to call attention to my origional "Entryprice= "coding that is
supposed to cause an entry to occur at the opening price of the
day "AFTER" the buy condition was met. This is my attempt to refer to
tomorrow's opening price in order to identify the correct "(buy on the
open price)" for tomorrow. Will my coding immediately below do
this, and if not, then I wonder why will it not ?
Entryprice=<FONT color=#0000ff
size=1>ValueWhen(<FONT color=#0000ff
size=1>Cross(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),<FONT color=#0000ff
size=1>StochD(<FONT color=#ff00ff
size=1>14)),<FONT color=#0000ff
size=1>Ref(Open,<FONT color=#ff00ff
size=1>0),1<FONT
size=1>);//<FONT
color=#008000 size=1>opening price of the Day after
Buy=Cross(FastStoch, SlowStoch);
==============================================<FONT face=Arial
size=2>
<FONT
face=Arial size=2>Immediately below here is my origional "Exitprice=" coding
that is supposed to cause an exit to occurr at the opening price of the
day "AFTER" the buy condition was met. This "Exitprice= "code is
supposed to select tomorrow's opening price as the Exit
price. <FONT face="Times New Roman"
color=#0000ff> I understand
that <FONT
face="Times New Roman">ValueWhen(<FONT
color=#0000ff>Cross(StochD(<FONT
color=#ff00ff>14),StochK(<FONT
color=#ff00ff>14)),Open,1); , <FONT
size=3>would referr to the
<FONT
face="Times New Roman">opening price today, which is the day that the buy
signal actually occurrs. <FONT
face="Times New Roman">Since I want to reference tomorrow's opening
price, which is the day after the buy signal actually occurrs, I have
replaced ,Open,1); with the
following: <FONT
color=#0000ff>,Ref(Open,<FONT
color=#ff00ff>0),BarsSince(<FONT
color=#0000ff>Cross(StochK(<FONT
color=#ff00ff>14),StochD(<FONT
color=#ff00ff>14)));
In this revised code, "Open" has been changed to> "Ref(Open,O)" and
the number "1);" has been changed to
> ",BarsSince(cross(stochK(14),stochD(14)));"
This "Exitprice=" coding of mine produces a
syntax error at the ; at the right end of the code
line'
Exitprice=<FONT color=#0000ff
size=1>ValueWhen(<FONT color=#0000ff
size=1>Cross(<FONT color=#0000ff
size=1>StochD(<FONT color=#ff00ff
size=1>14),<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14)),<FONT color=#0000ff
size=1>Ref(Open,<FONT color=#ff00ff
size=1>0),<FONT color=#0000ff
size=1>BarsSince(<FONT color=#0000ff
size=1>Cross(<FONT color=#0000ff
size=1>StochK(<FONT color=#ff00ff
size=1>14),<FONT color=#0000ff
size=1>StochD(<FONT color=#ff00ff
size=1>14)));<FONT face="Courier New" color=#008000
size=1>//Open price of Sell
Day.
I will study this revised code below as soon
as I send this. Regardless of whether this current version copied
below is correct or not, I would like to hear comments regarding my logic,
or lack thereof, in the coding that I used in both the "EntryPrice=" and
"ExitPrice=" codes that I created.
Did I use the correct codes to produce
the three additional columns of Buydate, Selldate, and Daysintrade?
If my last three colums are coded correctly, then this current version is
not selling on the following day, or on a later day, as it should
be. Once again, I greatly appreciate all of your great
help.
Ron D
<FONT color=#000000
size=2>==============================================================================
FastStoch = StochK(
14 );
SlowStoch = StochD(
14 );
Buy = Cross(
FastStoch, SlowStoch );
Sell = Cross(
SlowStoch, FastStoch );
StochKBuy = ValueWhen(
Buy, FastStoch );
StochKSell = ValueWhen(
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 );
Rtn = XPrice - EPrice;
PctRtn = Rtn / EPrice * 100<FONT
size=1>;
Buydate=<FONT face="Courier New" color=#0000ff
size=1>ValueWhen(<FONT
size=1>EPrice,<FONT
face="Courier New" color=#0000ff size=1>Day<FONT face="Courier New"
size=1>(),1<FONT
face="Courier New" size=1>);
Selldate=ValueWhen<FONT
size=1>(XPrice<FONT
size=1>,Day(),<FONT
color=#ff00ff size=1>1);<FONT face="Courier New"
size=1>
Daysintrade=Selldate-Buydate;
Filter = C > 1<FONT
size=1> AND C < <FONT color=#ff00ff
size=1>100 AND V > <FONT
color=#ff00ff size=1>100000;
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( Rtn, <FONT color=#ff00ff
size=1>"made$<FONT
color=#ff00ff size=1>", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( PctRtn, "%
Rtn", 1.2<FONT
size=1> );
AddColumn( Buydate, <FONT color=#ff00ff
size=1>"Eday<FONT
color=#ff00ff size=1>", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( Selldate, <FONT color=#ff00ff
size=1>"Xday<FONT
color=#ff00ff size=1>", <FONT color=#ff00ff
size=1>1.2 );
AddColumn( Daysintrade, <FONT color=#ff00ff
size=1>"X-E<FONT
color=#ff00ff size=1>", <FONT color=#ff00ff
size=1>1.2 );
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.
|