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

Re: [amibroker] Re: Optimize function



PureBytes Links

Trading Reference Links



<FONT 
size=2>----- Original Message ----- 
From: "DIMITRIS TSOKAKIS" <<A 
href=""><FONT 
size=2>TSOKAKIS@xxxxxxxxx>To: 
<<FONT 
size=2>amibroker@xxxxxxxxxxxxxxx<FONT 
size=2>>Sent: Friday, September 12, 2003 2:18 PMSubject: [amibroker] 
Re: Optimize functionBill,(Initial 
message)k=Optimize("k",40,30,50,10);> d2002=DateNum()>=1020101 AND 
DateNum()<1030101;> LastTradingBar=(d2002==0 AND 
Ref(d2002,-1))*DateNum();> Buy=d2002*Cross(StochD(),k);> 
Sell=d2002*Cross(StochD(),70) OR DateNum()==LastTradingBar;>> Hit 
now Optimize for> *current stock> *all quotations> AA will 
see only 2002 dates.(Second message)Optimization, by itself, has no 
restriction property.When we say Optimize, the AA will check the settings or 
whateveroverwrites the settings.In my example, the settings are "all 
quotations".But, the trading rules are restricted by 
definition:Buy=d2002*Cross(StochD(),k);Sell=d2002*Cross(StochD(),70) 
;This d2002 is a binary quantity, equal to 1 or 0, as definrd in 
theprevious lines. The d2002*something will give something or 
0.Consequently, when d2002 is true, the AA will 
readBuy=Cross(StochD(),k);Sell=Cross(StochD(),70);and when d2002 is 
false, the AA will readbuy=0;sell=0;Make a scan for all quotations 
to see. The trades will be for 2002dates only.In other words, in order 
to optimize from datenum1 to datenum2, justdefine trades for this period 
only and thatīs it !!As I mentioned to Leo a few 
minutes ago, I am not using AA but rather generating charts with IB.  
I don't know whether AA's optimization process works like the Optimize function 
in IB but suspect it might.  With that uncertainty as background, I think 
we are talking about apples and oranges.  Yes your code will produce trades 
only in 2002 with an optimized value for k (optimized in code from first 
message), and I use other code at the present time to achieve similar 
results.  However, the basic question is whether k was optimized for the 
entire dataset or just 2002.  As far as I can tell it is for the entire 
dataset, reflecting the fact that the Optimize function does not have a time 
frame argument(s) and, therefore, no way to limit its operation to a specified 
time window.  As a result, I wondered if anyone had a workaround that would 
force the Optimize function to only use data within a specified time 
frame.  One could, use brute force and manually change the number of bars 
and time period loaded, but that is too awkward to be seriously 
considered.--- In <A 
href=""><FONT 
size=2>amibroker@xxxxxxxxxxxxxxx, 
"wavemechanic" <<FONT 
size=2>wd78@x...> 
wrote:>> ----- Original Message ----- > From: "DIMITRIS 
TSOKAKIS" <<FONT 
size=2>TSOKAKIS@x...>> To: 
<<FONT 
size=2>amibroker@xxxxxxxxxxxxxxx<FONT 
size=2>>> Sent: Friday, September 12, 2003 12:48 PM> Subject: 
[amibroker] Re: Optimize function>>> > Bill,> 
> I have posted in the past the walk-forward optimization.> > Here 
is the basic principle, for a restricted period optimization> > 
[year2002 in the example]>> If I correctly understand, 
optimization of k is still beingestablished on> the entire dataset, 
rather than only on 2002 data.  Right?  If so,how would> 
you restrict Optimize to operate only in 2002?>> > of a 
Stochastic o/b, o/s system :> >> > 
k=Optimize("k",40,30,50,10);> > d2002=DateNum()>=1020101 AND 
DateNum()<1030101;> > LastTradingBar=(d2002==0 AND 
Ref(d2002,-1))*DateNum();> > Buy=d2002*Cross(StochD(),k);> > 
Sell=d2002*Cross(StochD(),70) OR DateNum()==LastTradingBar;> >> 
> Hit now Optimize for> > *current stock> > *all 
quotations> > AA will see only 2002 dates.> > It is 
important to exit any open trade by the end of the testperiod,> > 
else the last probable Open trade will last for ever !!> > The 
solution is that{  OR DateNum()==LastTradingBar } statement.> > 
Dimitris Tsokakis> > --- In <A 
href=""><FONT 
size=2>amibroker@xxxxxxxxxxxxxxx, 
"wavemechanic" <<FONT 
size=2>wd78@x...>wrote:> 
> >> > > ----- Original Message ----- > > > 
From: "Stephane Carrasset" <<A 
href=""><FONT 
size=2>nenapacwanfr@x...>> 
> > To: <<A 
href=""><FONT 
size=2>amibroker@xxxxxxxxxxxxxxx<FONT 
size=2>>> > > Sent: Friday, September 12, 2003 11:55 AM> 
> > Subject: [amibroker] Re: Optimize function> > >> 
> >> > > > Bill,> > > >> > > 
> do you mean if you Backtest for example NDX on the last 500bars> 
> > > do you want optimize an indicator on the 500-400 bars?? 
thenkeep> > the> > > > optimized value on the 
400-1 bars ??> > >> > > I was not thinking of that, 
but your scenario is along the same> > lines and> > > 
would be a another important option.  I was actually thinking of> 
> the problem> > > from 180 degrees around.  Specifically, 
for a dataset of, for> > example, 1000> > > bars optimize 
only over the last 500 and display the equitycurve> > for 
that> > > range.  It is possible to only consider (and 
display) the equity> > for a> > > specified number of 
bars (e.g., the last 500 bars), but I don'tsee> > how to> 
> > restrict optimization to those bars.  Certainly not with 
the> > available> > > arguments for Optimize.> 
> >> > > >> > > > Stephane> > 
> >> > > > > It is my understanding that the Optimize 
function operateson> > all> > > > data.  
So,> > > > > for example, if one is looking at equity for a 
portion ofthe> > data> > > > (e.g.,> > 
> > > Equity(0, 1, 100) Optimize still operates on all data.  
Does> > anyone> > > > have a> > > > 
> work-around that will force Optimize to only consider a> > 
specified> > > > range of> > > > > 
data?> > > > >> > > > > Thanks.> 
> > > >> > > > > Bill> > > 
>> > > >> > > >> > > > Send 
BUG REPORTS to <FONT 
size=2>bugs@x...> > > > 
Send SUGGESTIONS to <FONT 
size=2>suggest@x...> > > 
> -----------------------------------------> > > > Post 
AmiQuote-related messages ONLY to:<A 
href=""><FONT 
size=2>amiquote@xxxxxxxxxxxxxxx> 
> > > (Web page: <A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amiquote/messages/<FONT 
size=2>)> > > > 
--------------------------------------------> > > > Check group 
FAQ at:> > > <A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
size=2>> > > >> > > > Your use of Yahoo! Groups is 
subject to> > <A 
href=""><FONT 
size=2>http://docs.yahoo.com/info/terms/<FONT 
size=2>> > > >> > > >> >> 
>> >> > Send BUG REPORTS to <A 
href=""><FONT 
size=2>bugs@x...> > Send 
SUGGESTIONS to <FONT 
size=2>suggest@x...> > 
-----------------------------------------> > Post AmiQuote-related 
messages ONLY to: <A 
href=""><FONT 
size=2>amiquote@xxxxxxxxxxxxxxx> 
> (Web page: <A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amiquote/messages/<FONT 
size=2>)> > --------------------------------------------> > 
Check group FAQ at:> <A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
size=2>> >> > Your use of Yahoo! Groups is subject 
to<FONT 
size=2>http://docs.yahoo.com/info/terms/<FONT 
size=2>> >> >------------------------ Yahoo! Groups 
Sponsor ---------------------~-->Buy Ink Cartridges or Refill Kits for 
Your HP, Epson, Canon or LexmarkPrinter at Myinks.com. Free s/h on orders 
$50 or more to the US & Canada.<A 
href=""><FONT 
size=2>http://www.c1tracking.com/l.asp?cid=5511<A 
href=""><FONT 
size=2>http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM<FONT 
size=2>---------------------------------------------------------------------~->Send 
BUG REPORTS to <FONT 
size=2>bugs@xxxxxxxxxxxxxSend 
SUGGESTIONS to <A 
href=""><FONT 
size=2>suggest@xxxxxxxxxxxxx<FONT 
size=2>-----------------------------------------Post AmiQuote-related 
messages ONLY to: <A 
href=""><FONT 
size=2>amiquote@xxxxxxxxxxxxxxx(Web 
page: <A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amiquote/messages/<FONT 
size=2>)--------------------------------------------Check group FAQ 
at:<A 
href=""><FONT 
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT 
size=2>Your use of Yahoo! Groups is subject to <A 
href=""><FONT 
size=2>http://docs.yahoo.com/info/terms/






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.