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

Re: [amibroker] Code skipping buy & sell signals



PureBytes Links

Trading Reference Links

Can anyone help me on this most simple code skipping buy and sell signals?
 
James 

----- Original Message ----
From: James <jamesmemphis@xxxxxxxxx>
To: amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, July 29, 2008 11:32:29 AM
Subject: [amibroker] Code skipping buy & sell signals

I'm hoping someone can help me figure out why the following code seems to be missing buy and sell signals. If you overlay this code on a 30 minute bar chart of ESU8 using day session only data, you will see it missed a buy signal at 10:30 am today. Missed a sell yesterday at 11:30 am. Both of these were signals that would have been ignored if the exrem statements were left in, because it was already positioned in the direction of the signal. However, if you go back to 7/22 you will se where it missed an initial buy at 1:30pm, the bar immediately after the sell at 1:00pm. All times Central. I have found many missed signals and cannot determine what is causing it.
 
Should be buying when it crosses the most recent peak high and selling when crossing the most recent peak low. I would think this is about as simple as it gets and I still can't make it work properly.
 
TIA,
James
 
SetFormulaName ("Pivot Point Entry");

/*
Building block
Entry based on price crossing a peak high or peak low.
*/


PHigh = (
Ref (H, -2) > Ref (H, -3) AND Ref (H, -2) > Ref (H, -1
) );
PHighPrice =
ValueWhen(Phigh, Ref(H,-2), 1
);
PLow = (
Ref (L, -2) < Ref (L, -3) AND Ref (L, -2) < Ref (L, -1
) );
PLowPrice =
ValueWhen(PLow, Ref(L,-2), 1
);

Buy = Cross(H
, PhighPrice);
Sell = Cross (PLowPrice, L
);
Short = Cross (PLowPrice, L
);
Cover = Cross (H
, PHighPrice);

BuyPrice = Max (PHighPrice, Open
);
ShortPrice = Min (PLowPrice, Open
);
SellPrice = Min (PLowPrice, Open
);
CoverPrice = Max (PHighPrice, Open
);

//Buy=ExRem( Buy,Sell) ;

//Sell=ExRem( Sell, Buy);

//Short=ExRem( Short,Cover) ;

//Cover=ExRem( Cover,Short) ;


PlotShapes (IIf(Buy,shapeUpArrow,shapeNone), colorGreen,0,Low
);
PlotShapes (IIf(Sell,shapeHollowDownArro w,shapeNone), colorRed,0,High
);
PlotShapes (IIf(Short,shapeDownArrow,shapeNone), colorRed,0,High
);
PlotShapes (IIf(Cover,shapeHollowUpArrow,shapeNone), colorGreen,0,Low
);

"PHigh: " + NumToStr( PHigh, 1.2
);
"PLow: " + NumToStr( PLow, 1.2
);
"PHighPrice: " + NumToStr( PHighPrice, 1.2
);
"PLowPrice: " + NumToStr( PLowPrice, 1.2
);
"Buy: " +  NumToStr( Buy, 1.2
);
"Short: " + NumToStr( Short, 1.2
);

PositionSize = MarginDeposit
;



__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___