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

Re: [amibroker] Re: SetForeign() again



PureBytes Links

Trading Reference Links

Dimitirs,

It should work OK unless you have set trade delays > 0.
If so you would need to adjust first line:

lastbar = BarIndex()==Lastvalue(BarIndex()) - 1;

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, December 02, 2003 12:33 PM
Subject: [amibroker] Re: SetForeign() again


> Tomasz,
> I pasted the new code.
> Unfortunately, everything remained the same.
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
> wrote:
> > Dimitris,
> > 
> > Actually it happens for the very last bar because of the following 
> change described in the read me:
> > 
> > a.. changed handling of open positions in old backtester to match 
> with portfolio backtester and equity plot:
> > -  open positions are closed always at CLOSE price (previously were 
> closed at trade price)
> > 
> > Due to oversight it is close price of current symbol always. Will 
> be fixed in next beta.
> > 
> > Temporary workaround: close positions at the last bar:
> > 
> > lastbar = BarIndex()==Lastvalue(BarIndex());
> > Buy=Cross(StochD(),30);Sell=Cross(StochD(),80);Short=Sell;Cover=Buy;
> > 
> > Sell = Sell OR Lastbar;
> > Cover = Cover OR lastbar;
> > e1=Equity(1,0);Plot(e1,"STOCK",5,1); 
> > list = GetCategorySymbols( categoryWatchlist, 8 );
> > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > {
> > SetForeign(sym,True,True);
> > global Buy;global Sell;global Short;global Cover;
> > Buy=Cross(StochD(),30);Sell=Cross(StochD(),80);Short=Sell;Cover=Buy;
> > 
> > Sell = Sell OR Lastbar;
> > Cover = Cover OR lastbar;
> > e2=Equity(1,0);
> > Plot(e2,sym,i+1,8);
> > }
> > 
> > 
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> >   ----- Original Message ----- 
> >   From: Dimitris Tsokakis 
> >   To: amibroker@xxxxxxxxxxxxxxx 
> >   Sent: Tuesday, December 02, 2003 11:48 AM
> >   Subject: [amibroker] Re: SetForeign() again
> > 
> > 
> >   Tomasz,
> >   I have a small WL8 with BRCM, CPWR, FLEX, JDSU.
> >   The 
> > 
> >   Plot(StochD(),"STOCK",5,1); 
> >   list = GetCategorySymbols( categoryWatchlist, 8 );
> >   for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> >   {
> >   SetForeign(sym,True,True);e2=StochD();Plot(e2,sym,i+1,8);
> >   }
> > 
> >   and the
> > 
> >   Buy=Cross(StochD(),30);Sell=Cross(StochD
> (),80);Short=Sell;Cover=Buy;
> >   e1=Equity(1,0);Plot(e1,"STOCK",5,1); 
> >   list = GetCategorySymbols( categoryWatchlist, 8 );
> >   for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> >   {
> >   SetForeign(sym,True,True);
> >   global Buy;global Sell;global Short;global Cover;
> >   Buy=Cross(StochD(),30);Sell=Cross(StochD
> (),80);Short=Sell;Cover=Buy;
> >   e2=Equity(1,0);
> >   Plot(e2,sym,i+1,8);
> >   }
> >   are plotted.
> >   The last Equity value is quite strange and different from stock 
> to stock.
> >   [My initial equity is 10000 and the min.shares is 0.01]
> >   Something is going on with the last bar[s], the 4 equity values 
> are correct [and unchanged] from the beginning
> >   up to two/three bars before the end.
> >   The result ?? All my Inspection Points graphs are useless now !!
> >   The Dec2 session is an Inspection bar for one of them...
> >   Please advise.
> >   Dimitris Tsokakis
> > 
> > 
> >   Hello,
> > 
> >   It is not broken. But please note that Equity() now uses 
> MINSHARES setting.
> > 
> >   It is mentioned in the Read Me but I want to remind that 
> >   "MinShares" setting (now available in Auto-analysis -> 
> Settings, "General" page )
> >   affects ALL backtesters now. This includes Equity() function.
> > 
> >   So for example if you are trying to display equity for say DJIA
> >   but the initial equity is less than (say) 9000 then no trade will 
> be entered if
> >   MinShares is set to 1.
> > 
> >   You would need to enter 0.0001 in "MinShares" to allow very small 
> fractional
> >   quantities.
> > 
> >   Hope this helps.
> > 
> >   Best regards,
> >   Tomasz Janeczko
> >   amibroker.com
> >   ----- Original Message ----- 
> >   From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> >   To: <amibroker@xxxxxxxxxxxxxxx>
> >   Sent: Tuesday, December 02, 2003 8:02 AM
> >   Subject: [amibroker] SetForeign() again
> > 
> > 
> >   > Tomasz,
> >   > In 4.44 you introduced the 
> >   > SetForeign( ticker, fixup = True, tradeprices = False) 
> >   > and this allowed Equity() to work well with SetForeign.
> >   > Unfortunately with 4.50 it is down again. Can you fix it, 
> please.
> >   > Dimitris Tsokakis
> > 
> > 
> >         Yahoo! Groups Sponsor 
> >               ADVERTISEMENT
> >              
> >        
> >        
> > 
> >   Send BUG REPORTS to bugs@xxxx
> >   Send SUGGESTIONS to suggest@xxxx
> >   -----------------------------------------
> >   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.
> 
> 
> 
> 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 http://docs.yahoo.com/info/terms/ 
> 
> 
>

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/