The FindSymbol call looks correct but the code is incomplete. 
When you need help you need to send FULL code for analysis.
Specifically there is no part for entering trades. Also it is not know if you 
call
ProcessTradeSignals or not. Send full code to support

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "tipequity" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, May 18, 2008 7:57 PM
Subject: [amibroker] Re: CBT and Nbar


> Tomasz
> 
> It seems in the following code I am incorrectly using FindSignal! 
> Would you please explain why? TIA
> 
> 
> --- In [email protected], "tipequity" <[EMAIL PROTECTED]> wrote:
>>
>> The following CBT code is supposed to sell a long position after 
> nth 
>> bar if I don't have a buy signal on the nth bar. The logic for the 
>> code is as follows:
>> 
>> 1. loop thru open position list
>> 2. if a positions has been open for nbar then check the buy list 
>> 3. if the symbols exits in the buy list do nothing else sell the 
>> position.
>> 
>> For some reason that I can not figure out, the new function 
>> FindSignal always return a null value. Can anybody provide some 
>> insight or an alternative solution? TIA
>> 
>> 
>> for ( pos = bo.GetFirstOpenPos(); pos; pos = bo.GetNextOpenPos() )
>> {
>> if ( pos.BarsInTrade >= Nbar ) 
>> {
>> _TRACE("i= " + i + " Date: " + dtstr + " Symbol: :" + 
>> pos.Symbol + " BarsinTrade: " +  pos.BarsInTrade + " Max Holding 
>> Period");
>> if ( Sig = bo.FindSignal( i, pos.Symbol, 1 ) )
>> {
>> // ignore sell signal if we also have a buy 
>> signal
>> _TRACE("i= " + i + " Date: " + dtstr + " 
>> Symbol: :" + pos.Symbol + " BarsinTrade: " +  pos.BarsInTrade + " 
>> ignore sell signal, we have Buy Signal, don't sell: " + sig);
>> }
>> else 
>> {
>> NextDayOprice = pos.getprice(i,"O");
>> bo.ExitTrade( i, pos.symbol, NextDayOprice, 
>> 5);
>> _TRACE("i= " + i + " Date: " + dtstr + " 
>> Symbol: :" + pos.Symbol + " BarsinTrade: " +  pos.BarsInTrade + " 
> We 
>> DONT have Buy Signal: " + sig );
>> }
>> }
>> }
>>
> 
> 
> 
> ------------------------------------
> 
> 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
> 
> 
> 

Reply via email to