I marked 2 lines below that seem problematic. example: pricebuy == BuyPrice[i]; should have only 1 equal sign
----- Original Message ----- From: "bernardedmond01" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, March 31, 2007 4:06 PM Subject: [amibroker] Re: Profit Target - Could somebody look over this please? > I've had a go at this based on the examples in the user guide, but I > can't get it to work. > > target1=1.02; > target2=1.05; > priceatbuy=0; > highsincebuy=0; > exit=0; > for (i=0; i<BarCount; i++) > { > if (priceatbuy==0 AND Buy[i]) > {priceatbuy== BuyPrice[i]; *********** > } > if (priceatbuy>0) > {highsincebuy=Max(High[i],highsincebuy); > if(exit==0 AND High[i]>=target1*priceatbuy) > {exit=1; > Buy[i]=sigScaleOut; > } > if (exit==1 AND High[i]>=target2*priceatbuy) > {exit==2; *************************** > SellPrice[i]=Max(Open[i],target2*priceatbuy); > > if (exit>=2) > { > Buy[i]=0; > Sell[i]=exit+1; > exit=0; > priceatbuy=0; > highsincebuy=0; > } > } > } > } > SetPositionSize( 50, spsPercentOfPosition * ( Buy == sigScaleOut ) ); > **************** > > > Where am I going wrong? > Thanks > > > > > 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 > > >
