PureBytes Links
Trading Reference Links
|
I agree the 1 in the second position seems wwrong, but that's what the
documentation says to use.
I have used nBar stops myself with no problems. If you want to send me the
code I'll try it on my system and see what I get.
Magicth @ comcast.net
--
Terry
From: "kanowna2000" <kanowna@xxxxxxxxxxxx>
Reply-To: amibroker@xxxxxxxxxxxxxxx
Date: Sun, 07 Nov 2004 22:08:23 -0000
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Limit Trade Length by Number of Bars
Terry,
Thank you for the suggestion. I used this line of code in my
backtest:
ApplyStop (3, 1, 50, 0, 0); // uses n-bar stop = 50
There was no change in my result. I still have many
trades closing with #Bars much greater than 50, e.g., 320, 241, 90,
87, etc. I also tried using ApplyStop (3, 2, 50, 0, 0) because it
seems to me that '1' in the 2nd parameter position means some kind of
percentage, whereas I am aiming at a number of bars. There is still
no difference.
Any other ideas?
Thanks again!
Joe
--- In amibroker@xxxxxxxxxxxxxxx, Terry <MagicTH@xxxx> wrote:
> Since you're already using ApplyStop why not try
>
> ApplyStop(3,1,30,0,0); //Type=nBarStop
> --
> Terry
>
>
> From: "kanowna2000" <kanowna@xxxx>
> Reply-To: amibroker@xxxxxxxxxxxxxxx
> Date: Sun, 07 Nov 2004 19:24:43 -0000
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Limit Trade Length by Number of Bars
>
>
> Hello Everyone,
>
> I am trying to limit the number of bars that my trades can stay
open,
> to see if this can make a difference in the profitability of my
> system. If my trade has been open 50 bars I want to close the
> trade. In the 'Stops' tab of BackTester Settings I typed 50 in
> the 'Bars' box of the 'N-bar stop' section, and I clicked the 'bars'
> radial button to enable this feature.
>
> I thought this would limit my trade lengths to 50 (or no more than
> 51, assuming sell at next day open), but I am still getting large
> trade lengths, like 320 bars, and so on. It does not seem to have
> made a difference from my original system. Below is the basic form
> of my code:
>
> PosQty = 10; // open positions
> SetOption("MaxOpenPositions", PosQty );
> PositionSize = -100/PosQty; // invest 100% of portfolio equity
> divided by max. position count
>
> Cond1 = ................ (various conditions)
> Cond2 = ................ (various conditions)
> Cond3 = ................ (various conditions)
> Cond4 = ................ (various conditions)
>
> BuyPrice = ValueWhen(Cond4, (High + Low)/2 );
>
> Buy = (BuyPrice >= Low AND BarsSince(Cond4) <= 10 AND
> BarsSince(Cond4) > 0) AND
> (BuyPrice >= 0.50 AND BuyPrice <= 10.00);
>
> ApplyStop (0, 1, 25, 1); // uses 25% max loss stop
> ApplyStop (1, 1, 90, 1); // uses 90% tgt prof stop
>
> Sell = Cross( MFI(14), 80);
>
> My system is a backtest run against all stocks for a 10-year period.
>
> Any help would be greatly appreciated. Many thanks.
>
> 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
<http://us.ard.yahoo.com/SIG=129ptj1ee/M=294855.5468653.6549235.3001176/D=g
roups/S=1705632198:HM/EXP=1099951783/A=2376776/R=0/SIG=11ldm1jvc/*http://pro
motions.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/> .
------------------------ 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/
|