Saturday, June 23, 2018

candlestick code

https://www.niftytradingacademy.net/amibroker-afl/scanner-and-candlestick-pattern-indicator

WhiteBody = C > O;
BigWhite = (Close – Open)/Open > 0.015 AND (Close – Open) * 2 > High – Low;
BlackBody = C < O;
BigBlack = (Open – Close)/Open > 0.015 AND (Open – Close) * 2 > High – Low;
Big = abs((Close – Open)/Open) > 0.014;
LongUpperShadow = H – Max(O,C) > (H – L)*0.67;
LongLowerShadow = Min(O,C) – L > (H – L)*0.67;
rng = abs((C-O)/O);
lowerShadow = Min(O,C) – L;
uppershadow = H – Max(O,C);
body = abs(O-C);
rngx = abs(H – L);
rngy = H-L;
shaven = lowerShadow < rngy*0.1;
ShavenBottom = L == Min(O,C);
ShavenHead = H == Max(O,C);
prevSize = abs(Ref(O,-1)-Ref(C,-1));
currentSize = abs(O-C);
fwh = Ref(H,-4);
fwl = Ref(L,-4);
isPrevLargeWhite = Ref(big,-1) AND Ref(whitebody,-1);
SmallRealBody = rng < 0.003 AND rng >0;
Diff = abs((prevSize – currentSize) / currentSize);
DownTrend = (H < Ref(H,-1) AND L < Ref(L,-1));
UpTrend = (H > Ref(H,-1) AND L > Ref(L,-1));
isPrevUpTrend = Ref(uptrend,-1);
RealBodyGapUp = Min(O,C) > Max(Ref(O,-1),Ref(C,-1));
RealBodyGapDown = Max(O,C) < Min(Ref(O,-1),Ref(C,-1));
FallingWindow = Ref(downtrend,-1) AND GapDown();
RisingWindow = Ref(uptrend,-1) AND GapUp();
isfalling = bigblack AND fallingwindow;
isrising = bigwhite AND risingwindow;
rwh = Ref(H,-4);
rwl = Ref(L,-4);
isFallingBlack = Ref(fallingwindow,-1) AND Ref(blackbody,-1);
horw = Ref(H,-2);
windowOpen = C < horw;
opensInside = O < Ref(O,-1) AND O > Ref(C,-1);
similarSize = diff <= 0.25;
GapUpFromWhite = realBodyGapUp AND isPrevLargeWhite AND isPrevUptrend;
isPrevLargeBlack = Ref(big,-1) AND Ref(blackbody,-1);
isPrevDownTrend = Ref(downtrend,-1);
GapDownFromBlack = realBodyGapDown AND isPrevLargeBlack AND isPrevDowntrend;
isRisingWhite = Ref(risingwindow,-1) AND Ref(whitebody,-1);
lorw = Ref(L,-2);
windowOpenx = C > lorw;
Doji = C == O AND V > 0;
LongLeggedDoji = doji AND (H – L)/L > 0.01;
StarUp = smallRealBody AND gapUpFromWhite;
DojiStarUp = doji AND gapUpFromWhite;
DojiStarDown = doji AND gapDownFromBlack;
StarDown = smallRealBody AND gapDownFromBlack;
isPrevDownTrendx = Ref(downtrend,-3);
firstDoji = Ref(doji,-2);
secDojiLower = Ref(doji,-1) AND Ref(realBodyGapDown,-1);
isPrevUpTrendx = Ref(uptrend,-3);
secDojiHigher = Ref(doji,-1) AND Ref(realBodyGapUp,-1);
BeltHold = shavenbottom AND shavenhead AND big;
Engulfing = Max(O,C) > Ref(Max(O,C),-1) AND Min(O,C) < Ref(Min(O,C),-1);
UmbrellaLine = uppershadow < rngx*0.1 AND lowershadow > body*2;

No comments:

Post a Comment