hi, I added the following code (see below). Haco is 1 when it is long and 0 when short. To find the entry points for long and short you define: hc = Haco - Ref(Haco,-1); This leaves you with 1 at the entry for long and -1 for short. I added hc = Ref(hc,-1); because at the earliest you can enter at the open of the next bar. You could omit this and use the close price as the entry price. I made it to be a simple reversal system. tested on the QQQQ EOD data. Gives me -0.89% per year .....
regards, Ed hc = Haco - Ref(Haco,-1);hc = Ref(hc,-1); Buy = IIf(hc == 1,1,0); BuyPrice = O; Sell = IIf(hc == -1,1,0); SellPrice = O; Cover = Buy; CoverPrice = O; Short = Sell; ShortPrice = O; PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-15); PlotShapes(IIf(Buy,shapeHollowUpArrow,shapeNone),colorWhite,0,L,-15); PlotShapes(IIf(Buy,shapeHollowSmallCircle,shapeNone),colorWhite,0,BuyPrice,0); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15); PlotShapes(IIf(Sell,shapeHollowDownArrow,shapeNone),colorWhite,0,H,-15); PlotShapes(IIf(Sell,shapeHollowSmallCircle,shapeNone),colorWhite,0,SellPrice,0); PlotShapes(IIf(Short,shapeDownTriangle,shapeNone),colorYellow,0,H,IIf(Short AND Sell,-30,-15)); PlotShapes(IIf(Short,shapeHollowDownTriangle,shapeNone),colorWhite,0,H,IIf(Short AND Sell,-30,-15)); PlotShapes(IIf(Short,shapeHollowCircle,shapeNone),colorWhite,0,ShortPrice,0); PlotShapes(IIf(Cover,shapeUpTriangle,shapeNone),colorLightBlue,0,L,IIf(Cover AND Buy,-30,-15)); PlotShapes(IIf(Cover,shapeHollowUpTriangle,shapeNone),colorWhite,0,L,IIf(Cover AND Buy,-30,-15)); PlotShapes(IIf(Cover,shapeHollowCircle,shapeNone),colorWhite,0,CoverPrice,0); ----- Original Message ----- From: gonzagags To: [email protected] Sent: Wednesday, December 03, 2008 10:46 AM Subject: [amibroker] Re: heikin ashi oscillator Ups! To get away the down arrows, I need another line I have forgotten: short=ExRem(short,cover); cover=ExRem(cover,short); So I only have the other doubt.. (:-|) This oscillator seems to be pretty good.. --- In [email protected], "gonzagags" <[EMAIL PROTECTED]> wrote: > > Hi > Has anybody read the December Stock commodities article about the > heikin ashi oscillator? > There is the code for Amibroker, but.. > I want to test it buying and selling, and shorting and covering > > The orders should be?: > //-------------------------- > Haco=Flip(upw,dnw); > > Buy=Haco; > Sell=NOT Haco; > > Short=NOT Haco; > Cover=Haco; > Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); > //----------------------- > > I have some doubts: does it buy or short one day before it knows the > oscillator is red or green? > How could I take out the so many down arrows? > > thanks >
