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

[amibroker] Problem with Exploration



PureBytes Links

Trading Reference Links





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( 
Buy, FastStoch );
StochKSell = ValueWhen( 
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 > 1<FONT 
size=1> AND C < <FONT color=#ff00ff 
size=1>100 AND V > <FONT 
color=#ff00ff size=1>100000;
AddColumn( StochKBuy, 
"Buy Value", <FONT 
color=#ff00ff size=1>1.2 );<FONT color=#0000ff 
size=1>
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, "% 
Rtn", 1.2<FONT 
size=1> );
<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( 
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 );<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)); <FONT face="Courier New" 
color=#008000 size=1>
////////////////////////////////////////////////////////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);
Filter = C > 1<FONT 
size=1> AND C < <FONT color=#ff00ff 
size=1>100 AND V > <FONT 
color=#ff00ff size=1>100000 AND 
Buy OR Sell;<FONT 
color=#0000ff size=1>
SetOption(<FONT color=#ff00ff 
size=1>"NoDefaultColumns", True );<FONT 
color=#0000ff size=1>
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, "% 
Rtn", 1.2<FONT 
size=1> );
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, 83<FONT 
size=1> ), "Signal", 
formatChar );
///////////////////////////////////////////<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> 






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.