PureBytes Links
Trading Reference Links
|
Hello,
For starters: there is not big difference if you choose Cross vs > function.
Cross checks essentially '<=' condition on previous bar and '>' on current bar.
The results would be the same (with the possible exception of very first
trade that > will give you at the beginning of backtest) because
under normal circumstances you are allowed to hold only ONE open
position for one symbol. So it does not matter if you have repetitive signals
- they will be simply ignored until matching sell occurs, see this how it works:
http://www.amibroker.com/gifs/bt_regular.gif
As to your question regarding optimization, your results do not change
when second (MA2) changes because your ENTRY rule does not depend on
MA2. Only MA1 is used in "Buy" rule and it decides which trades are taken or not.
MA2 is used ONLY for exits and because of small averaging period exits
occur right after entry so it does not modify your results, and they in fact
depend solely on entry strategy.
You should really run Scan, to find out when all signals occur to learn
the way signals are converted to trades.
And again this:
http://www.amibroker.com/gifs/bt_regular.gif
is worth studying. It shows "Regular backtest".
There are 3 other backtest modes available (RegularRaw, RegularRawMulti and rotational)
but I would suggest to start with the regular first.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "longarm61" <norm1@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, August 20, 2007 5:13 AM
Subject: [amibroker] Re: Optimization Help
> Hey, Steve, thanks for the reply. That's interesting because I used
> the AFL Wizard for my buy and sell code. Wonder why it would give me
> code that generates a buy for every bar that remains above the MA?
> It's also interesting that for a 1-month backtest using 5-minute
> bars, my original code yielded only 1 more trade (line) than your
> code did.
>
> But the thing I'd really like help understanding is the
> Optimization. I tried it using your code and I'm still confused by
> the results. For example, it shows:
>
> NET % PROFIT MA MA
> ------------ ---- ----
> 3.28 133 5
> 3.28 133 15
> 3.28 133 8
> 3.28 133 9
>
> As you can see, it shows the same net % profit for every result with
> a MA of 133, even though the MAs in the second column are all
> different. In fact, ALL the numbers in all the columns are
> indentical for the MA-133. Why would that be? Doesn't the first MA
> above represent MA1 and the second MA represent MA2?
>
> Either I'm still doing something wrong or I'm misunderstanding
> something (very possible!), since obviously trades with different MAs
> for sells aren't going to have the exact same results, even if buys
> use the same MA.
>
> Looking for enlightenment. Thanks.
>
>
>
>
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxx> wrote:
>>
>> Hi, your code gives buy sig not just on crossover but also on every
> bar
>> where MA3 remains above the MA it just crossed. Similar result for
> sell
>> sigs. Try it this way...
>>
>> Buy = Cross( MA( Close , 3 ), MA( Close , MA1 ) );
>> Sell = Cross( MA( Close , MA2 ), MA( Close , 3 ) );
>>
>> Steve
>>
>> ----- Original Message -----
>> From: "longarm61" <norm1@xxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Sunday, August 19, 2007 6:09 PM
>> Subject: [amibroker] Optimization Help
>>
>>
>> > Hello, complete AFL newbie here. This should be a simple one.
> If I
>> > have a system whereby a 3-bar MA crosses another MA to buy, and a
> 3-
>> > bar MA crosses a different MA to sell, how would I code the
>> > optimization to find the most profitable COMBINATION of MAs for
> the
>> > buy and sell?
>> >
>> > Here's how I attempted to do it--I know it's wrong, as it crunched
>> > numbers for about 2 hours but then gave me results that made no
> sense:
>> >
>> >
>> > MA1 = Optimize ( "MA", 50, 5, 200, 1 );
>> > MA2 = Optimize ( "MA", 50, 5, 200, 1 );
>> >
>> > Buy = MA( Close , 3 ) > MA( Close , MA1 );
>> >
>> > Sell = MA( Close , 3 ) < MA( Close , MA2 );
>> >
>> > Short = 0;
>> >
>> > Cover = 0;
>> >
>> >
>> > Thanks in advance for your patience and help.
>> >
>> >
>> >
>> > Please note that this group is for discussion between users only.
>> >
>> > To get support from AmiBroker please send an e-mail directly to
>> > SUPPORT {at} amibroker.com
>> >
>> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> > http://www.amibroker.com/devlog/
>> >
>> > For other support material please check also:
>> > http://www.amibroker.com/support.html
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>>
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> Yahoo! Groups Links
>
>
>
>
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|