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

[amibroker] optimisation not working correctly?



PureBytes Links

Trading Reference Links

I'm trying to optimise with the folowing code. When I look at the
results, the winning and losing average bars (which should be fixed)
does not correspond at all with the "length" parameter, which should
govern it?

The code is as follows;

PB=Optimize("PB",0.99,0.97,0.998,0.002);
Length=Optimize("Length",12,3,15,1);

Cond1=Ref(C,-1)<PB*Ref(C,-2);
Cond2=C>Ref(C,-1);


Buy = Cond1 AND Cond2;
Sell = False;
inTrade = False;
bcnt = 0;            

for (i = 0; i < BarCount; i++)
{ if (inTrade)     
 {
 Buy[i] = False;              
}
if (++bcnt == Length)
{inTrade = False;
Sell[i] = True;
}else
{
if (Buy[i])
{inTrade = True;bcnt = 0;
}
    }}

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

Can anyone help?

Thanks,
Rich


------------------------------------

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/