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 [email protected], "Steve Dugas" <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]> > To: <[email protected]> > 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 > > > > > > > > >
