Does anyone know how to fix the problem below? Thanks
--- In [email protected], "cagigas00" <[EMAIL PROTECTED]> wrote: > > > Hello, this is the extract of the code (actually it is more > complicated): > > Cond1 = [cond1 rules]; > > B1=Ref(Cond1,-1) AND L < BBandBot(C,20,2) ; > > Cond2=[cond2 rules]; > > B2= Ref(Cond2,-1) AND H > Ref(H,-1); > > Cond3= [cond3 rules]; > > B3= Ref(Cond3,-1) AND H > Ref(H,-1) ; > > Cond4 = [cond4 rules]; > > B4=Ref(Cond4,-1) AND H > Ref(y2,-1); > > Buy=B1 OR B2 OR B3 OR B4; > > BuyPrice= IIf(B1,BBandBot(C,20,2), > > IIf(B2,Max(Ref(H,-1),Open), > > IIf(B3,Max(Ref(H,-1),Open), > > IIf(B4,Ref(y2,-1),Close) ) ) ); > > Sell=Open > ValueWhen(Buy,BuyPrice); > > SellPrice=Open; > > ApplyStop(stopTypeLoss,stopModePercent,5,True,True); > > Equity(1); > > What happens is that when long and B1 or B2 or B3 or B4 happens they > change the buyprice so the first profitable opening is not related to > the original buyprice. It sells at the first profitable opening of the > last buy signal. I need to tell Amibroker that if it is long already do > not accept any buy signals. > > Thanks > > Oscar > > > --- In [email protected], Graham <kavemanperth@> wrote: > > > > you may need to use a FOR loop > > you could also try using applystop > > you could also use Equity > > > > You have not shown your code so cannot demonstrate how to change it > > > > -- > > Cheers > > Graham > > AB-Write >< Professional AFL Writing Service > > Yes, I write AFL code to your requirements > > http://www.aflwriting.com > > > > > > On 02/03/07, cagigas00 cagigas00@ wrote: > > > Hello, > > > > > > I am using a system with several entries and one exit, the first > > > profitable opening. The problem that I have is that when the system > is > > > long and there is another buy signal coming Amibroker changes the > > > buyprice, therefore my system exits at a price different than > expected. > > > It is not a problem that can be fixed with exrem(). > > > > > > I can fix this if I tell Amibroker not to consider any additional > > > signals if it is long already. But when I try to code this I always > > > have the error "variable inlong not defined" (inlong=flip (buy,sell)) > > > since I need to use it BEFORE the buy statement definition. > > > > > > The solution is to simulate the marketposition of tradestation. I > have > > > heard about static variables, but honestly I don't know how to fix > this. > > > > > > > > > Any ideas? > > > > > > Thanks > > > Oscar > > > > > > > > > > > > > > > > > > > > > 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 > > > > > > > > > > > > > > >
