PureBytes Links
Trading Reference Links
|
I have never found any bug with Nbarstop
ex below works perfectly
Buy= DayOfWeek()==5;
Sell=0;
BuyPrice= C ;
ApplyStop (stopTypeLoss, stopModePoint,2*ATR(10) ,True) ;
ApplyStop (stopTypeTrailing, stopModePoint, 20*ATR(10) ,True,False) ;
ApplyStop (stopTypeProfit, stopModePoint, 20*ATR(10) ,True,False) ;
ApplyStop(stopTypeNBar,stopModeBars,50);
Plot(Close,"close",colorBlack,64);
Equity(1);
PlotShapes(IIf(Buy,
shapeUpArrow,shapeNone),colorGreen,0,L,-20);
PlotShapes(IIf(Sell,
shapeDownArrow,shapeNone),colorRed,0,H,-20);
// StopLoss
Plot(ValueWhen(Buy,C+2*ATR(10)),"Profit",colorBlue,1);
Plot(ValueWhen(Buy,C-2*ATR(10)),"StopLoss",colorRed,1);
Plot(HighestSince(Buy,H)-ValueWhen(Buy,2*ATR(10)),"Trailing",colorGreen,1);:
>
> Dear Tomasz,
>
> Fellow AB Forum members have kindly offered suggestions to my problem
> but it has not been resolved. I was wondering if you might give this
> problem some thought.
>
> It seems to me that the N-Bar stop feature in AB might have a bug, or
> perhaps I am doing something wrong. I have tried suggestions made
> recently by other members but somehow I am not getting any difference
> in my results. (To see the code I am running please refer to
> previous posts made by me under the title 'Limit Trade Length by
> Number of Bars'). In my attempts to resolve my problem I have tried
> the following steps:
>
> 1. I placed the line ApplyStop( stopTypeNBar, stopModeBars, 50 );
> right after the 2 'stop' lines in my code and submitted the code; many
> trades still run much longer than 50 Bars.
>
> 2. I ran the code with the line above placed IN FRONT OF my 2 'stop'
> lines in my code and submitted the code; the result is the same as run
> (1).
>
> 3. I enabled the N-bar stop by clicking the 'bars' radial button and
> typed 50 in the Bars box and ran the code; again, same result as run
> (1).
>
> I would like to clarify the problem I am encountering by showing you
> some of my output results. The following shows 15 lines of output
> results, sorted by #bars in descending order (1 heading line and 14
> lines of actual data). I have omitted certain columns because they
> are irrelevant:
>
> Ticker Trade Date Price Ex. date
> Ex. Price Profit # bars
>
> CTRA Long (profit) 11/13/1998 6.8438 2/3/2000 35.00
> 4,519.15 320
> ECPG Long (profit) 8/7/1998 3.5313 7/9/1999
> 9.13 1,938.20 241
> MBLA Long (n-bar) 3/5/1997 6.8175 7/8/1997
> 6.75 -25.21 90
> AVD Long (n-bar) 1/23/1995 1.8783 5/25/1995
> 1.75 -43.17 87
> PEX Long (n-bar) 8/19/1999 6.25 12/9/1999
> 6.00 -64.25 81
> CRRC Long 11/10/1997 8.6667 2/20/1998
> 8.07 -105.85 75
> CNBC Long (n-bar) 4/23/1998 8.227 8/4/1998
> 6.68 -297.82 74
> CRED Long (n-bar) 2/2/1996 0.9375 5/15/1996
> 0.97 13.59 72
> CLFC Long (n-bar) 6/13/2002 6.4815 9/18/2002
> 6.00 -506.42 68
> PTEN Long (n-bar) 11/1/1994 0.9844 2/3/1995
> 0.75 -129.32 66
> DCAI Long (n-bar) 1/27/1999 0.6094 4/27/1999
> 0.64 36.48 65
> AVD Long (max loss) 8/4/1997 2.5482 10/30/1997
> 1.91 -338.26 64
> IPAR Long (n-bar) 11/17/2000 5.9167 2/20/2001
> 6.08 77.46 64
> CW Long (n-bar) 10/24/1994 8.95315 1/23/1995
> 8.88 -18.30 63
>
> As you can see, the 1st two lines, CTRA and ECPG, exit for Long
> (profit) reason, which means because of the ApplyStop (1, 1, 90, 1)
> code for target profit. The next 3 lines show exit for Long (n-bar)
> reason, which means because of the code ApplyStop( stopTypeNBar,
> stopModeBars, 50 ) for 50-bar limit. The remaining 9 lines show exit
> for reasons of MFI crossover at 80, 50-bar limit, stop loss 25%, and
> 50-bar limit.
>
> It is immediately obvious that the 50-bar limit is not controlling
> the exit, or perhaps it is not working properly --- maybe there is a
> bug? Or perhaps I am not setting it up correctly?
>
> Can you please check the possibility that AB's N-Bar stop is not
> overriding the other stops, i.e. maybe there is a bug?
>
> Thank you.
>
> Josef
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here
> <http://us.ard.yahoo.com/SIG=129n6aosh/M=294855.5468653.6549235.3001176/D=groups/S=1705632198:HM/EXP=1100084241/A=2376776/R=0/SIG=11ldm1jvc/*http://promotions.yahoo.com/ydomains2004/index.html>
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/amibroker/
>
> * To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxxxx
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
>
>
> __________ Information NOD32 1.876 (20040924) __________
>
> Ce message a ete verifie par NOD32 Antivirus System.
> http://www.nod32.com
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|