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

RE: [amibroker] Sequential higher highs



PureBytes Links

Trading Reference Links

Try this:

n = Param("Pd",3,1,20,1);
//n = Optimize("Pd",3,1,20,1); // Uncomment this line for optimization
Buy     = Sum(C > Ref(C, -1),n) >= n;
Sell    = Ref(Buy,-n);
Plot(C,"",1,128);

You can copy the following code to a Utility folder in you Chart-Tree and drag it onto your system's code when you want to see the signals and prices. Or just tag it on to the above code.

herman

PricesOnInclude = ParamToggle("Plot Trade Prices","HIDE|SHOW",1);
ArrowsOnInclude = ParamToggle("Plot Trade Arrows","HIDE|SHOW",1);
ShowSignalTitle = ParamToggle("Title Trade info","HIDE|SHOW",0);

if( PricesOnInclude )
        {
        PlotShapes(IIf(Buy,     shapeSmallCircle, shapeNone),5,0,BuyPrice,0);
        PlotShapes(IIf(Sell,    shapeHollowCircle, shapeNone),4,0,SellPrice,0);
        PlotShapes(IIf(Cover, shapeHollowCircle, shapeNone),5,0,CoverPrice,0);
        PlotShapes(IIf(Short, shapeSmallCircle, shapeNone),4,0,ShortPrice,0);
        }
if( ArrowsOnInclude )
        {
        PlotShapes(IIf(Buy,     shapeUpArrow, shapeNone), 5,0,L, -20);
        PlotShapes(IIf(Sell,    shapeDownArrow, shapeNone), IIf(Sell==3, 6, IIf(Sell==2, 7,  4)),0,H, -20);
        PlotShapes(IIf(Short, shapeHollowDownArrow, shapeNone), 4,0,H, -38);
        PlotShapes(IIf(Cover, shapeHollowUpArrow, shapeNone), IIf(Cover==3, 6, IIf(Cover==2, 7, 5)),0,L, -38);
        }

if( ShowSignalTitle )
Title="\nSignals for Selected Bar: \n"+
EncodeColor(colorBlack)+
WriteIf(Buy,"  BUY"+NumToStr(Buy,1.0)+" "+" @ "+NumToStr(BuyPrice,1.2)+ "\n","")+
WriteIf(Short,"SHORT"+NumToStr(Short,1.0)+" "+" @ "+NumToStr(ShortPrice,1.2)+"\n","")+
WriteIf(Sell," SELL"+NumToStr(Sell,1.0)+" "+" @ "+NumToStr(SellPrice,1.2)+"\n","")+
WriteIf(Cover,"COVER"+NumToStr(Cover,1.0)+" "+" @ "+NumToStr(CoverPrice,1.2)+"\n","")+"\n";


-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf Of Keith Osborne
Sent: Sunday, February 19, 2006 5:00 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Sequential higher highs


Hi, the following gives me a buy condition if there are 3 successive
higher highs.

Buy = C > Ref(C, -1)  AND Ref(C, -1) > Ref(C, -2) AND Ref(C, -2) >
Ref(C, -3); /* 3 increased closes in a row */

What I would like to do is optimize or param this so that I can backtest
over a shorter/longer lookback, say 2 to 6 periods. How can I do this
other than by a long string of Ref(c, -X) type conditions. Do I have to
enter the world of loops (something I can't do).

TIA.........Keith



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 other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software



YAHOO! GROUPS LINKS

 Visit your group "amibroker" on the web.
 
 To unsubscribe from this group, send an email to:
 amibroker-unsubscribe@xxxxxxxxxxxxxxx
 
 Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



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 other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS