[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Pyramiding / ScaleIn Questions


  • Date: Fri, 19 Feb 2010 03:06:54 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: Pyramiding / ScaleIn Questions

PureBytes Links

Trading Reference Links

Richard,

I'm not questioning the frequency of trades. What I'm saying is to not trust the avg. profit for any backtest results that they published.

In other words, assume that the strategy results are optimized for the entire life of the symbol right up until the date of publication, and that the strategy parameters have never been run against out of sample data.

For example; If their results were published on Jan 1, 2008 I would backtest *starting* at Jan 1, 2008 and evaluate the metrics from that.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "Richard" <richpach2@xxx> wrote:
>
> Hi Mike,
> 
> I think, the key to the high hit rate is the exits. Connors uses no stops and most systems exit at the first/early profit opportunity.
> Nothing wrong with that, but the avg. profit is only 1.5% (with avg. bars in trade 4.8). If you change the exit to some sort of trailing exit the success rate drops to ~60%
> 
> Regards
> Richard
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> >
> > Check the most recent publication date and assume that all data from ETF inception to publication was used as in sample (IS). Only returns beyond the publication date can safely be considered out of sample (OOS).
> > 
> > Mike
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "droskill" <droskill@> wrote:
> > >
> > > Pretty insane results with some select ETFs - tried it with EEM and SPY and results in the +90% success rate.  Makes me doubt the results!
> > > 
> > > I'd love to see this code actually get to a portfolio - so, start by determining taking initial equity and then dividing it among a set number of positions (say 4) to see how it would do with a portfolio.
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "longt3rm" <longt3rm@> wrote:
> > > >
> > > > droskill,
> > > > 
> > > > First -- thanks for many posts (here and others) I've read of yours which have helped me greatly.
> > > > 
> > > > Code below:
> > > > ----------------------------------------
> > > > //Created by Mike http://finance.groups.yahoo.com/group/amibroker/message/146956
> > > > //Updated per Mike http://finance.groups.yahoo.com/group/amibroker/message/146967
> > > > //Update by Bill to change EMA to MA and change from fixed shares to fixed dollar
> > > > 
> > > > SetTradeDelays(0, 0, 0, 0); 
> > > > BuyPrice = Close; 
> > > > SellPrice = Close; 
> > > > 
> > > > previousClose = Ref(Close, -1); 
> > > > rsi2 = RSI(2); 
> > > > 
> > > > Sell = Cross(rsi2, 70); 
> > > > 
> > > > //bull100 = Close > EMA(Close, 200) AND Sum(rsi2 < 25, 2) == 2; 
> > > > bull100 = Close > MA(Close, 200) AND MA(Close, 200) > 0  AND Sum(rsi2 < 25, 2) == 2; 
> > > > inFirstPos = Flip(bull100, Sell); 
> > > > firstTrigger = ExRem(inFirstPos, Sell); 
> > > > 
> > > > bull200 = Close < ValueWhen(firstTrigger, Close) AND inFirstPos AND Ref(inFirstPos, -1); 
> > > > inSecondPos = Flip(bull200, Sell); 
> > > > secondTrigger = ExRem(inSecondPos, Sell); 
> > > > 
> > > > bull300 = Close < ValueWhen(secondTrigger, Close) AND inSecondPos AND Ref(inSecondPos, -1); 
> > > > inThirdPos = Flip(bull300, Sell); 
> > > > thirdTrigger = ExRem(inThirdPos, Sell); 
> > > > 
> > > > bull400 = Close < ValueWhen(thirdTrigger, Close) AND inThirdPos AND Ref(inThirdPos, -1); 
> > > > inFourthPos = Flip(bull400, Sell); 
> > > > fourthTrigger = ExRem(inFourthPos, Sell); 
> > > > 
> > > > Buy = firstTrigger + (secondTrigger * sigScaleIn) + (thirdTrigger * sigScaleIn) + (fourthTrigger * sigScaleIn); 
> > > > //SetPositionSize(IIf(firstTrigger, 100, IIf(secondTrigger, 200, IIf(thirdTrigger, 300, 400))), spsShares); 
> > > > SetPositionSize(IIf(firstTrigger, 1000, IIf(secondTrigger, 2000, IIf(thirdTrigger, 3000, 4000))), spsValue); 
> > > > 
> > > > 
> > > > priceColors = IIf(Close > previousClose, colorDarkGreen, IIf(Close < previousClose, colorDarkRed, colorDarkGrey)); 
> > > > buyColors = IIf(firstTrigger, colorGreen, IIf(secondTrigger, colorLime, IIf(thirdTrigger, colorYellow, colorOrange))); 
> > > > 
> > > > Plot(Close, "Price", priceColors, styleBar); 
> > > > PlotShapes((Buy > 0) * shapeUpArrow, buyColors, 0, L, -10); 
> > > > PlotShapes(Sell * shapeDownArrow, colorRed);
> > > > ----------------------------------------
> > > > 
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "droskill" <droskill@> wrote:
> > > > >
> > > > > Bill - can you post the total code?  I'd love to have an example of this as I have been trying to do the same thing.
> > > > > 
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "longt3rm" <longt3rm@> wrote:
> > > > > >
> > > > > > Mike,
> > > > > > 
> > > > > > Fantastic, it works!
> > > > > > 
> > > > > > Thank you for your help!
> > > > > > 
> > > > > > Bill
> > > > > > 
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> > > > > > >
> > > > > > > Bill,
> > > > > > > 
> > > > > > > You would need to calculate the trigger first (i.e. ExRem of position state), then use ValueWhen.
> > > > > > > 
> > > > > > > e.g. Something like the following:
> > > > > > > 
> > > > > > > thirdTrigger = ExRem(inThirdPos, Sell);
> > > > > > > bull400 = Close < ValueWhen(thirdTrigger, Close) AND inThirdPos AND Ref(inThirdPos, -1);
> > > > > > > 
> > > > > > > The key being that Flip will give all 1's for the duration that we are in the position, whereas ExRem will remove redundant 1's leaving only those bars where the condition was first met. Thus, ValueWhen gives the Close of the most recent bar meeting that condition.
> > > > > > > 
> > > > > > > Mike
> > > > > > > 
> > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "longt3rm" <longt3rm@> wrote:
> > > > > > > >
> > > > > > > > Mike,
> > > > > > > > 
> > > > > > > > Thank you! That helps significantly!!
> > > > > > > > 
> > > > > > > > The one item I'm not able to figure out is how to track the last entry price so we can check to see if the current close is lower than our last entry. 
> > > > > > > > 
> > > > > > > > I believe (I could be mistaken) the sample you kindly provided is checking to see if today's close is less than yesterday's close. I would like to compare today's close to our last entry price.
> > > > > > > > 
> > > > > > > > Thanks again for helping so much. I am slow to grasp AFL.
> > > > > > > > 
> > > > > > > > Sincerely,
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Bill
> > > > > > > > 
> > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> > > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > I posted some code to a related question here:
> > > > > > > > > http://finance.groups.yahoo.com/group/amibroker/message/146956
> > > > > > > > > 
> > > > > > > > > Short answers:
> > > > > > > > > 1. Use Flip function to capture current position "state".
> > > > > > > > > 2. Use state captured above AND'ed with next criteria.
> > > > > > > > > 
> > > > > > > > > See if that helps.
> > > > > > > > > 
> > > > > > > > > Mike
> > > > > > > > > 
> > > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "longt3rm" <longt3rm@> wrote:
> > > > > > > > > >
> > > > > > > > > > Hello,
> > > > > > > > > > 
> > > > > > > > > > Goal Description: 
> > > > > > > > > > 1) Initial $500 position opened when RSI(2) < 25
> > > > > > > > > > 2) Add $1000 to position when entry price for #1 is less than current close. (regardless of value for RSI(2))
> > > > > > > > > > 3) Add $1500 to position when entry price for #2 is less than current close. (regardless of value for RSI(2))
> > > > > > > > > > 4) If all three positions are entered, we would have a total position of $3,000
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > Two questions / problems:
> > > > > > > > > > 1) What is the most efficient way to determine if we have a position and if we do, is it the first ($500) or second ($500+$1000=$1500)?
> > > > > > > > > > 2) If the initial buy is "Buy = RSI(2)", how do we tell AmiBroker that RSI(2) is not longer needed, we just need current close > last position entry price.
> > > > > > > > > > 
> > > > > > > > > > Thanks for any suggestions.
> > > > > > > > > > 
> > > > > > > > > > Sincerely,
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > Bill
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/