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

[amibroker] Re: Coding help.



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "sesamys" <sesamys@xxx> wrote:
I hope I got everything right.

You might want to check you criteria (discrepancy between up and down
Key definitions), but code is fairly straight forward.

Key revs in darker colour.

Correct logic as you see fit.

All the best...
CJ

************

// Logic.
UpRev = L < Ref(L,-1) AND (C > Ref(C, -1) OR C > Ref(H, -1));
DownRev = H > Ref(H, -1) AND (C < Ref(C, -1) OR C < Ref(L, -1));
UpKeyRev = C < Ref(L, -1) AND Ref(C, 1) > C AND Ref(C, 1) > Ref(C, -1);
DownKeyRev = C > Ref(C, -1) AND Ref(C, 1) < C AND Ref(C, 1) < Ref(C, -1);

// Plotting.
PlotShapes(UpRev * shapeSmallUpTriangle, colorPaleGreen, 0, H, 20);
PlotShapes(DownRev * shapeSmallDownTriangle, colorOrange, 0, L, 20);
PlotShapes(UpKeyRev * shapeSmallUpTriangle, colorGreen, 0, H, 20);
PlotShapes(DownKeyRev * shapeSmallDownTriangle, colorRed, 0, L, 20);




>
> Gentelmen,
> I need your help to transform this idea into AFL code.
> Thanks in anticipation.
> The idea is to plot an arrow above (or under) the bar indicating a
> reversal day as per the belowmentioned:
> 1- Upside Reversal:
> If Day n low < Day n-1 low.
> AND Day n close > Day n-1 close or Day n-1 high.
> 2- Downside Reversal:
> If Day n high > Day n-1 high.
> AND Day n close < Day n-1 close or Day n-1 low.
> 3- Upside key reversal day.
> IF Day n close < Day n-1 low.
> AND Day n+1 close > Day n close and day n-1 close.
> 4- Downside key reversal day.
> IF Day n close > Day n-1 close.
> AND Day n+1 close < Day n close and day n-1 close.
> Your help is highly appreciated.
> Best regards.
>




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006