PureBytes Links
Trading Reference Links
|
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
<*> 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/
|