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

RE: [amibroker] Re: Code challenge - gurus on your toes!



PureBytes Links

Trading Reference Links




<SPAN 
class=991190416-18032003>Dale,
take a 
very simple system....
<SPAN 
class=991190416-18032003> 
<FONT 
color=#000000> 
Buy=Cross(C,MA(C,50<FONT 
color=#0000ff>));<FONT 
size=2>
Sell=Cross(MA(C<FONT 
face=Arial>,50),C<FONT color=#0000ff 
face=Arial>);<FONT 
color=#0000ff>
Filter=Buy OR Sell<FONT 
color=#0000ff>;<FONT 
size=2>
AddColumn(<FONT 
color=#000000>Buy<FONT 
color=#282828>,"Buy"<FONT 
color=#282828>);<FONT 
size=2>
AddColumn(<FONT 
color=#000000>Sell<FONT 
color=#282828>,"sell"<FONT 
color=#282828>);
 
run 
the back test on CSCO then click actual trades.
<SPAN 
class=991190416-18032003> 
<IMG 
align=baseline alt="" border=0 hspace=0 
src="gif00134.gif">
<SPAN 
class=991190416-18032003> 
Here you see the 
actual cross over occurred on 2/28 (circled) the trade arrow in back test  
shows the following day 3/3 (delay=1)
<SPAN 
class=991190416-18032003> 
<IMG align=baseline 
alt="" border=0 hspace=0 src="gif00135.gif">
<SPAN 
class=991190416-18032003> 
To find this trade 
the previous night you would run the same code in AA as an 
exploration.......
<SPAN 
class=991190416-18032003> 
<IMG align=baseline 
alt="" border=0 hspace=0 src="gif00136.gif">
<SPAN 
class=991190416-18032003> 
As you see the 
explore correctly identifies the 2/28 buy as well as the 3/3 sell ahead of the 
trade arrows generated by the back test. If you are looking at EOD on 2/28 you 
would place the buy order that evening as a market order. This would execute on 
the 3/3 open (for better or worse).
 
 Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: dingo 
[mailto:dingo@xxxxxxxxxx]Sent: Tuesday, March 18, 2003 10:10 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
Re: Code challenge - gurus on your toes!

<SPAN 
>The point about using 
Amibroker to trade the open on the next day was this:
<SPAN 
> 
<SPAN 
>Take a simple system 
you have in your files and run a back test on it for a date range of your 
choice. (be sure and have your settings = delay = 1, open).  Look down the 
trade list and pick any date where a position is taken and write that date 
down.  Now pretend that you are processing your data (assuming you are 
using EOD data) on the night BEFORE the date you wrote down &#8211; trying to see what 
trades, if any, you will have to set up for the next day.  Now run a Scan 
or Explore and tell me if you see any evidence of a trade for the next 
day?  What do you do to know that you need to put in an 
order?
<SPAN 
> 
<SPAN 
>d
<SPAN 
> 
<SPAN 
>-----Original 
Message-----From: phsst 
[mailto:phsst@xxxxxxxxx] Sent: 
Tuesday, March 18, 2003 12:32 AM<SPAN 
>To: amibroker@xxxxxxxxxxxxxxx<SPAN 
>Subject: [amibroker] Re: Code challenge - 
gurus on your toes!
<FONT face="Times New Roman" 
size=3> 
<FONT face="Courier New" 
size=2><Dale, you have probably forgotten more 
about system design than I<FONT face="Courier New" 
size=2><FONT 
face="Courier New">know but for what it is worth I do use delay=1 and Price=Open 
forevaluation and back testing in 
AA, although in practice I seldom<FONT 
face="Courier New">actual buy the open. I have been burned too many times by 
this ficklemarket. Instead I wait 
30 minutes to let the dust settle. Interday I<FONT 
face="Courier New">plot actual signals based on high or low. 
(delay=o)>I don't target to 
trade Mkt OPEN either... but prefer to trade Limit<FONT 
face="Courier New">or Stop orders based upon previous days price action. 
In the case of Buy Limit 
orders, I usually determine the Limit price<FONT 
face="Courier New">from previous days Close, and to my surprise, I very often 
get actualexecutions at OPEN the 
following day which are significantly less than<FONT 
face="Courier New">previous days close (my limit order) and have experienced 
positivetrading system outcomes as 
a result (my primary trading system is a<FONT 
face="Courier New">pullback system). Also, when this occurs it is not unusual 
for theOPEN to be the low for the 
day!You can setup your 
backtest's for this condition, and depending upon<FONT 
face="Courier New">your trading system you will observe backtest results that 
mirror whatI have encountered in 
actual trades.Logically, I 
thought that MM's would look at limit orders at open 
andtake them out before gapping 
down, but that has not been my actual<FONT 
face="Courier New">trading experience with these orders (either NYSE or 
NASD).My point is that while 
you may not want to trade the OPEN with market<FONT 
face="Courier New">orders... the OPEN is not necessarily your enemy either... it 
can beyour friend when your trading 
system picks out pullbacks that are<FONT 
face="Courier New">close enough to exhaustion gaps which can be exploited using 
Limit orders.And as far as 
using Amibroker to signal trades with delay = 1 and<FONT 
face="Courier New">Price = Open on the evening before the trade... here is a 
code snipetthat should come 
close:(b is the boolean BUY 
trigger variable)b = BUY 
CONDITION SETUPPctRisk = C - (L - 
0.1) / C;TargetPrice = 
HHV(C,10);PctGain = (TargetPrice - 
C) / C;b = b AND PctGain >= 
0.12;    // At least 12% Profit 
potentialBuyPrice = 
Min(Ref(C,-1),O); // Lessor of Previous Close or Todays 
openb = b AND BuyPrice > 
L;Buy = 
b;That should do it, if I have 
not mis-understood what you are asking for.<FONT 
face="Courier New">OR simply code BuyPrice = O;<FONT 
face="Courier New">Phsst--- In 
amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> 
wrote:> 
Dale,> <FONT 
face="Courier New">> Often I just guess <G><FONT 
face="Courier New">> > Help 
defines an array as....> What is 
an Array?> 
> An array is simply a list (or 
row) of values. In some books it may be<FONT 
face="Courier New">> referred to as a vector. Each numbered row of values in 
the example> represents an 
individual array. Amibroker has stored in its database 
6> arrays for each stock. One 
for opening price, one for the low price,<FONT 
face="Courier New">one for> the 
high price, one for the closing price and one for volume 
(seethe 
rows> labeled 1-5 below) and one 
for open interest. These can be<FONT 
face="Courier New">referenced in AFL<FONT 
face="Courier New">> as open, low, high, close, volume, openint or o, l, h, 
c, v, oi.> 
> If you are referencing one of 
the 6 arrays or making calculations<FONT 
face="Courier New">based on> 
them then it is an array.  In your example you used Status 
todetermine 
what> AB was doing (Scan, 
Explore etc) Since this state is not stored nor<FONT 
face="Courier New">> calculated from the six arrays you must  use 
lastvalue() .> 
> " One more thing: Do you use 
Amibroker to signal trades with delay =<FONT 
face="Courier New">1 and> Price 
= Open?  On the evening before the trade do you use plots 
totell you<FONT 
face="Courier New">> to trade the next morning or do you use some formula in 
the AA and run a> Scan or 
Explore to tell you?"> 
> Dale, you have probably 
forgotten more about system design than I<FONT 
face="Courier New">know but> for 
what it is worth I do use delay=1 and Price=Open for 
evaluationand 
back> testing in AA, although in 
practice I seldom actual buy the open. I have<FONT 
face="Courier New">> been burned too many times by this fickle market. 
Instead I wait 30<FONT 
face="Courier New">minutes> to 
let the dust settle. Interday I plot actual signals based on 
highor 
low.> 
(delay=o)> 
> 
Regards,> 
> 
jayson> 
> <FONT 
face="Courier New">> > 
> <FONT 
face="Courier New">> > 
> 
Jayson> -----Original 
Message-----> From: dingo 
[mailto:dingo@xxxx]> Sent: 
Monday, March 17, 2003 4:23 PM> 
To: amibroker@xxxxxxxxxxxxxxx> 
Subject: RE: [amibroker] Code challenge - gurus on your 
toes!> <FONT 
face="Courier New">> > Have I 
tried it? NO but looks like that is the magic answer!!!<FONT 
face="Courier New">> > 
> <FONT 
face="Courier New">> I get totally wrapped around the axle to this day on 
what is anarray 
and> what is not an 
array.> 
> <FONT 
face="Courier New">> > If you 
have the time could you explain how this works at the<FONT 
face="Courier New">individual bar<FONT 
face="Courier New">> level? If not I understand and really appreciate this!! 
It justmight 
help> the little light go on in 
my head (yea, right!).> 
> <FONT 
face="Courier New">> > One 
more thing: Do you use Amibroker to signal trades with delay = 1 
and> Price = Open?  On the 
evening before the trade do you use plots to<FONT 
face="Courier New">tell you> to 
trade the next morning or do you use some formula in the AA and run 
a> Scan or Explore to tell 
you?> <FONT 
face="Courier New">> > 
> Thanks Jason!  You are 
great to be here help us as much as you do!<FONT 
face="Courier New">> > 
> <FONT 
face="Courier New">> d> 
> <FONT 
face="Courier New">> > 
-----Original Message-----> 
From: Jayson [mailto:jcasavant@xxxx]<FONT 
face="Courier New">> Sent: Monday, March 17, 2003 3:56 
PM> To: 
amibroker@xxxxxxxxxxxxxxx> 
Subject: RE: [amibroker] Code challenge - gurus on your 
toes!> <FONT 
face="Courier New">> > 
> Dale have you tried 
lastvalue(tmpdelay)> 
> <FONT 
face="Courier New">> > 
> <FONT 
face="Courier New">> tmpDelay = IIf(Status("action") == 5, 1, 
0);> <FONT 
face="Courier New">> tmpdelay=LastValue(tmpdelay);<FONT 
face="Courier New">> > 
> <FONT 
face="Courier New">> I think this needs to be a fixed 
number..> 
> <FONT 
face="Courier New">> > 
Jayson> 
> -----Original 
Message-----> From: dingo 
[mailto:dingo@xxxx]> Sent: 
Monday, March 17, 2003 3:41 PM> 
To: _amibroker_yahoo> Subject: 
[amibroker] Code challenge - gurus on your toes!<FONT 
face="Courier New">> > I'm 
trying to write some AFL code that will change the trade delays 
and> trade prices based solely 
on whether the code is being run in the back<FONT 
face="Courier New">> tester/optimizer or not.<FONT 
face="Courier New">> > Here's 
a feeble attempt that doesn't work:<FONT 
face="Courier New">> > 
tmpDelay = IIf(Status("action") == 5, 1, 0);<FONT 
face="Courier New">> tmpPrice = IIf(Status("action") == 5, Open, 
Close);> 
> SetTradeDelays(tmpDelay, 
tmpDelay, tmpDelay, tmpDelay);> 
BuyPrice = SellPrice = ShortPrice = CoverPrice = 
tmpPrice;> 
> Lets see if you can solve this 
one!  (Use of vbScript is permissable)<FONT 
face="Courier New">> > 
d> <FONT 
face="Courier New">> > 
> Send BUG REPORTS to 
bugs@xxxx> Send SUGGESTIONS to 
suggest@xxxx> 
-----------------------------------------<FONT 
face="Courier New">> Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx> (Web 
page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
face="Courier New">> 
--------------------------------------------<FONT 
face="Courier New">> Check group FAQ at:<FONT 
face="Courier New">> <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
face="Courier New">> > Your 
use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.> 
> <FONT 
face="Courier New">> > 
> Send BUG REPORTS to 
bugs@xxxx> Send SUGGESTIONS to 
suggest@xxxx> 
-----------------------------------------<FONT 
face="Courier New">> Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx> (Web 
page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
face="Courier New">> 
--------------------------------------------<FONT 
face="Courier New">> Check group FAQ at:<FONT 
face="Courier New">> <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
face="Courier New">> > Your 
use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.> 
> <FONT 
face="Courier New">> > 
<FONT 
face="Courier New">>       Yahoo! Groups 
Sponsor<FONT 
face="Courier New">>             
ADVERTISEMENT> 
> <FONT 
face="Courier New">> > 
> Send BUG REPORTS to 
bugs@xxxx> Send SUGGESTIONS to 
suggest@xxxx> 
-----------------------------------------<FONT 
face="Courier New">> Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx> (Web 
page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
face="Courier New">> 
--------------------------------------------<FONT 
face="Courier New">> Check group FAQ at:<FONT 
face="Courier New">> <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
face="Courier New">> > Your 
use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.<FONT 
face="Courier New" size=2>Send BUG REPORTS to 
bugs@xxxxxxxxxxxxx<SPAN 
><FONT 
face="Courier New">Send SUGGESTIONS to 
suggest@xxxxxxxxxxxxx<FONT 
face="Courier New">-----------------------------------------<FONT 
face="Courier New">Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx (Web page: 
<A 
href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
face="Courier New">--------------------------------------------<FONT 
face="Courier New">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.

Attachment: Description: ""

Attachment: Description: ""

Attachment: Description: ""