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,shapeHollowDownArrow,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;