Adjusted Trailing Stop Loss studied & fixed with dynamic color
Better Volume Indicator is taken out of the code
Heiken Ashi Multi-Time Frame added
Analysis Panel is moved above the Volume section on the left
Fibonacci Forcast replaced with “Signal Panel” since it also uses FIBO & gived a visual guide with possible target.
Better Volume Indicator is taken out of the code
Heiken Ashi Multi-Time Frame added
Analysis Panel is moved above the Volume section on the left
Fibonacci Forcast replaced with “Signal Panel” since it also uses FIBO & gived a visual guide with possible target.
Enjoy trading with confidence!!
Afl Code Here
_SECTION_BEGIN("CandleStick Analysis");
/*Body Colors*/
whiteBody=C>=O;
blackBody=O>C;
/*Body Size*/
smallBodyMaximum=0.0025;//less than 0.25%
LargeBodyMinimum=0.01;//greater than 1.0%
smallBody=(O>=C*(1-smallBodyMaximum) AND whiteBody) OR (C>=O*(1-smallBodyMaximum) AND blackBody);
largeBody=(C>=O*(1+largeBodyMinimum) AND whiteBody) OR C<=O*(1-largeBodyMinimum) AND blackBody;
mediumBody=NOT LargeBody AND NOT smallBody;
identicalBodies=abs(abs(Ref(O,-1)-Ref(C,-1))-abs(O-C)) < abs(O-C)*smallBodyMaximum;
realBodySize=abs(O-C);
/*Shadows*/
smallUpperShadow=(whiteBody AND H<=C*(1+smallBodyMaximum)) OR (blackBody AND H<=O*(1+smallBodyMaximum));
smallLowerShadow=(whiteBody AND L>=O*(1-smallBodyMaximum)) OR (blackBody AND L>=C*(1-smallBodyMaximum));
largeUpperShadow=(whiteBody AND H>=C*(1+largeBodyMinimum)) OR (blackBody AND H>=O*(1+largeBodyMinimum));
largeLowerShadow=(whiteBody AND L<=O*(1-largeBodyMinimum)) OR (blackBody AND L<=C*(1-largeBodyMinimum));
/*Gaps*/
upGap= IIf(Ref(blackBody,-1)AND whiteBody AND O>Ref(O,-1),1,
IIf(Ref(blackbody,-1) AND blackBody AND C>Ref(O,-1),1,
IIf(Ref(whiteBody,-1) AND whiteBody AND O>Ref(C,-1),1,
IIf(Ref(whiteBody,-1) AND blackBody AND C>Ref(C,-1),1,0))));
downGap=IIf(Ref(blackBody,-1)AND whiteBody AND C2*realBodySize) OR (whiteBody AND abs(H-C)>2*realBodySize));
Hammer=smallUpperShadow AND NOT doji AND ((blackBody AND abs(C-L)>2*realBodySize) OR (whiteBody AND abs(L-O)>2*realBodySize));
tweezerTop=abs(H-Ref(H,-1))<=H*0.0025;
tweezerBottom=abs(L-Ref(L,-1))<=L*0.0025;
engulfing=
IIf(blackBody AND Ref(blackbody,-1) AND CRef(O,-1),1,
IIf(blackBody AND Ref(whiteBody,-1) AND O>Ref(C,-1) AND CRef(C,-1) AND ORef(O,-1)AND ORef(C,-1),1,
IIf(blackBody AND Ref(whiteBody,-1) AND C>Ref(O,-1) AND ORef(O,-1),1,
IIf(whiteBody AND Ref(blackBody,-1) AND O>Ref(C,-1) AND CRef(O, -3)
AND CRef(C,-2)AND Ref(blackbody,-1)AND
blackBody AND engulfing;
/*Doji Star Bullish*/
dojiStarBullish=(dojiStar AND (MLT OR MLY))OR
(doji AND (C=Ref( C, -1) AND CRef(C,-1)*0.9975 AND C< Ref(C,-1)*1.0025;
/*Morning Doji Star*/
morningDojiStar= Ref(LargeBody,-2) AND Ref(blackBody,-2) AND
Ref(doji,-1) AND Ref(O,-1)Ref(C,-2) AND MLY;
/* Morning Star*/
morningStar =Ref(largeBody,-2) AND Ref(blackBody,-2)//Large black candle
AND Ref(downGap,-1)//Gap down yesterday
AND whiteBody AND LargeBody AND C>Ref(C,-2)//Large white candle today
AND MLY; //Yesterday was the low
/* Piercing Line*/
piercingLine= Ref(largeBody,-1) AND Ref(blackBody,-1)AND
O=(Ref(O,-1)+Ref(C,-1))/2 AND C=Ref(C,-2) AND O>=Ref(C,-1) AND
abs(C-Ref(C,-2))<=C*0.0025;
/*Three Inside Up harami confirming*/
threeInsideUp =Ref(Haramibullish,-1) AND whiteBody AND
largeBody AND C>Ref(C,-1);
/* Three Outside Up Engulfing confirmation*/
threeOutsideUp =Ref(engulfingBullish,-1) AND whiteBody AND C>Ref(C,-1);
/* Three Stars in the South*///Rewrite???
threeStarsInTheSouth=
Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(largelowerShadow,-2)
AND Ref(blackBody,-1) AND Ref(largeLowerShadow,-1) AND
Ref(L,-1)>Ref(L,-2) AND blackBody AND smallUpperShadow AND
smallLowerShadow AND L>Ref(L,-1) AND HRef(C,-2) AND
whiteBody AND CRef(O,-4) AND NOT Ref(LargeBody,-1) AND Ref(C,-1)Ref(C,-4);
/*RisingThreeMethods*/
risingThreeMethods=Ref(LargeBody,-4) AND Ref(whiteBody,-4) AND NOT
Ref(LargeBody,-3) AND NOT Ref(LargeBody,-2)AND NOT Ref(LargeBody,-1) AND
Ref(C,-3)Ref(C,-4);
/* Seperating Lines Bullish*/
separatingLinesBullish=Ref(blackBody,-1) AND whiteBody AND LargeBody AND
smallLowerShadow AND MHT AND abs(O-Ref(O,-1))<=O*0.0025;
/*Side by Side White Lines*/
sideBySideWhiteLines=NOT Ref(smallBody,-2) AND Ref(whiteBody,-2)
AND Ref(upGap,-1) AND Ref(whitebody,-1)AND whiteBody AND
identicalBodies AND abs(O-Ref(O,-1))Ref(C,-1) AND Ref(C,-1)>Ref(C,-2) AND
Ref(O,-1)>Ref(O,-2) AND Ref(O,-1)Ref(O,-1) AND Ref(smallUpperShadow,-2) AND
Ref(smallUpperShadow,-1) AND smallUppershadow AND LLV(L,12)==Ref(L,-2);
/*Upside Gap Three Methods not very good*/
upsideGapThreeMethods=Ref(Largebody,-2) AND Ref(whiteBody,-2) AND
Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(upGap,-1) AND
blackBody AND O>Ref(O,-1) AND CRef(O,-2) AND
MHY;
/*Three Line Strike not good signals*/
threeLineStrike=NOT Ref(smallBody,-3) AND NOT Ref(smallBody,-2) AND
NOT Ref(smallBody,-1) AND Ref(whiteBody,-3) AND Ref(whiteBody,-2) AND
Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND Ref(C,-2)>Ref(C,-3) AND
blackBody AND O>Ref(C,-1) AND CRef(O,-1) AND CRef(C,-2) AND
identicalBodies AND ORef(O,-2) AND Ref(O,-1)Ref(C,-2) AND C>Ref(C,-1) AND
ORef(O,-1) AND Ref(LargeUpperShadow,-1) AND LargeUpperShadow
AND C-ORef(O,-3) AND CRef(H,-1) AND C>Ref(O,-1) AND C<(Ref(O,-1)+Ref(C,-1))/2
AND MHT;
/*Deliberation Bearish: needs confirmation*/
deliberationBearish=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND Ref(C,-1)>Ref(C,-2) AND
smallbody AND upGap;
/*CounterAttackBearish*/
CounterAttackBearish=MHT AND LargeBody AND blackbody AND
Ref(largeBody,-1) AND Ref(whiteBody,-1) AND
CRef(C,-1)*0.9975;;
/*Doji Star Bearish*/
dojiStarBearish=(dojiStar AND (MHT OR MHY))OR
(doji AND (C>Ref(C,-1) OR O>Ref(C,-1))AND Ref(whiteBody,-1)
AND Ref(LargeBody,-1));
/*Engulfing Bearish*/
engulfingBearish=engulfing AND largeBody AND blackBody AND
(Ref(whitebody,-1) OR Ref(Doji,-1))AND (MHT OR MHY);
/*Evening Doji Star check formula???*/
eveningDojiStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
Ref(dojiStar,-1) AND Ref(GapUp(),-1) AND (MHY OR MHT);
/*Evening Star*/
eveningStar=Ref(LargeBody,-2) AND Ref(whiteBody,-2) AND
Ref(upGap,-1) AND NOT Ref(largeBody,-1) AND blackBody AND NOT smallBody AND
(MHT OR MHY);
/*Hammer Bearish*/
HammerBearish=Hammer AND HHV(H,8)==H;
/*hangingMan*/
HangingMan=NOT largeBody AND smallUpperShadow AND LargeLowerShadow AND MHT;
/*dragonfly Doji Bearish*/
dragonflyDojiBearish=doji AND smallUpperShadow AND LargeLowerShadow AND MHT;
/*Harami Bearish-*/
HaramiBearish=harami AND Ref(Largebody,-1) AND Ref(whiteBody,-1)AND blackBody
AND (MHY OR MHT);
/*HaramiCross Bearish*/
HaramiCrossBearish=harami AND doji AND Ref(whiteBody,-1) AND Ref(Largebody,-1);
/*Identical three black crows*/
idendicalThreeBlackCrows=Ref(blackBody,-2) AND Ref(blackBody,-1) AND blackBody AND
abs(Ref(C,-2)-Ref(O,-1))Ref(C,-1)AND CRef(O,-2) AND MHY;//Third day
/*Upside Gap Two Crows*/
upsideGapTwoCrows= Ref(whiteBody,-2) AND Ref(LargeBody,-2)// first day
AND Ref(upGap,-1) AND Ref(blackBody,-1) // 2nd day
AND blackbody AND O>Ref(O,-1) AND CRef(C,-2);
/*Doji Star Bearish needs confirmation
dojiStarBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) // first day
AND doji AND upGap AND MHT;*/
/* Downside Gap Three Methods*/
downsideGapThreeMethods=
Ref(LargeBody,-2) AND Ref(blackBody,-2) AND Ref(downGap,-2) //first day
AND Ref(LargeBody,-1) AND Ref(blackBody,-1)//2nd day
AND whitebody AND ORef(C,-2)
AND LLV(L,8)==Ref(L,-1);
/*Downside Tasuki Gap*/
downsideTasukiGap=
Ref(blackBody,-2)//first day
AND Ref(blackbody,-1) AND Ref(downgap,-1) //2nd day
AND whiteBody AND ORef(C,-1) AND C>Ref(O,-1) AND CRef(C,-2)
AND Ref(C,-2)>Ref(C,-3) AND LargeBody AND blackBody AND O>Ref(C,-4) AND
O=Ref(C,-1);
/*On Neck Bearish not good*/
OnNeckBearish=Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
whiteBody AND O=Ref(L,-1)*0.9975;
/*separating Lines Bearish*/
separatingLinesBearish=Ref(LargeBody,-1) AND Ref(whiteBody,-1) AND
blackBody AND O>Ref(O,-1)*0.9975 AND O<=Ref(O,-1)*1.0025;
/*Side By Side White Lines Bearish*/
sideBySideWhiteLinesBearish=NOT Ref(smallBody,-2) AND Ref(blackBody,-2) AND
Ref(whiteBody,-1) AND whiteBody AND Ref(downGap,-1) AND identicalBodies
AND abs(C-Ref(C,-1)Ref(O,-3);
/*Thrusting Bearish*/
thrustingBearish=Ref(blackBody,-1) AND Ref(LargeBody,-1) AND LargeBody AND
whitebody AND ORef(C,-1);
/*Tweezer Top*/
tweezerTop= (abs(H-Ref(H,-1))/H<0 data-blogger-escaped-.0025="" data-blogger-escaped-2-4="" data-blogger-escaped-:="" data-blogger-escaped-a="" data-blogger-escaped-abandonedbabybullish="" data-blogger-escaped-abs="" data-blogger-escaped-advanceblockbearish="" data-blogger-escaped-after="" data-blogger-escaped-and="" data-blogger-escaped-appears="" data-blogger-escaped-arami="" data-blogger-escaped-aramicross="" data-blogger-escaped-are="" data-blogger-escaped-at="" data-blogger-escaped-away="" data-blogger-escaped-baby="" data-blogger-escaped-bandoned="" data-blogger-escaped-beltholdbearish="" data-blogger-escaped-beltholdbullish="" data-blogger-escaped-better.="" data-blogger-escaped-better="" data-blogger-escaped-black="" data-blogger-escaped-body.="" data-blogger-escaped-body="" data-blogger-escaped-bottom.="" data-blogger-escaped-bottoms.="" data-blogger-escaped-breakawaybearish="" data-blogger-escaped-breakawaybullish="" data-blogger-escaped-bullish.="" data-blogger-escaped-bullish="" data-blogger-escaped-buy="abandonedBabybullish" data-blogger-escaped-c16liwick="" data-blogger-escaped-calling="" data-blogger-escaped-candles.="" data-blogger-escaped-candles="" data-blogger-escaped-candlestick="" data-blogger-escaped-commentary="" data-blogger-escaped-concealingbabyswallow="" data-blogger-escaped-confirmation.="" data-blogger-escaped-continuation="" data-blogger-escaped-counterattackbearish="" data-blogger-escaped-cross.="" data-blogger-escaped-darkcloudcover="" data-blogger-escaped-day="" data-blogger-escaped-deliberationbearish="" data-blogger-escaped-doji.="" data-blogger-escaped-doji="" data-blogger-escaped-dojistarbearish="" data-blogger-escaped-dojistarbullish="" data-blogger-escaped-downsidegapthreemethods="" data-blogger-escaped-downsidetasukigap="" data-blogger-escaped-dragonflydoji="" data-blogger-escaped-dragonflydojibearish="" data-blogger-escaped-drying="" data-blogger-escaped-eeting="" data-blogger-escaped-ef="" data-blogger-escaped-effectiveness="" data-blogger-escaped-elt="" data-blogger-escaped-engulfing.="" data-blogger-escaped-engulfingbearish="" data-blogger-escaped-engulfingbullish="" data-blogger-escaped-engulfs="" data-blogger-escaped-eveningdojistar="" data-blogger-escaped-eveningstar="" data-blogger-escaped-factors="" data-blogger-escaped-fallingthreemethods="" data-blogger-escaped-fast="" data-blogger-escaped-first="" data-blogger-escaped-gravestonedoji="" data-blogger-escaped-hammer.="" data-blogger-escaped-hammerbearish="" data-blogger-escaped-hammerbullish="" data-blogger-escaped-hangingman="" data-blogger-escaped-harami.="" data-blogger-escaped-haramibearish="" data-blogger-escaped-haramibullish="" data-blogger-escaped-haramicross="" data-blogger-escaped-haramicrossbearish="" data-blogger-escaped-has="" data-blogger-escaped-have="" data-blogger-escaped-heavy="" data-blogger-escaped-high.="" data-blogger-escaped-hold="" data-blogger-escaped-homingpigeon="" data-blogger-escaped-idendicalthreeblackcrows="" data-blogger-escaped-iercing="" data-blogger-escaped-in="" data-blogger-escaped-increasing="" data-blogger-escaped-indicator="" data-blogger-escaped-inneckbearish="" data-blogger-escaped-inside="" data-blogger-escaped-invertedhammer="" data-blogger-escaped-is.="" data-blogger-escaped-ising="" data-blogger-escaped-it="" data-blogger-escaped-kickingbearish="" data-blogger-escaped-large="" data-blogger-escaped-larger="" data-blogger-escaped-less="" data-blogger-escaped-line.="" data-blogger-escaped-lines="" data-blogger-escaped-litwick="" data-blogger-escaped-longer="" data-blogger-escaped-low.="" data-blogger-escaped-lower="" data-blogger-escaped-matholdbullish="" data-blogger-escaped-may="" data-blogger-escaped-meetinglinesbearish="" data-blogger-escaped-meetinglinesbullish="" data-blogger-escaped-methods.="" data-blogger-escaped-mhy="" data-blogger-escaped-moderate.="" data-blogger-escaped-moderate="" data-blogger-escaped-more="" data-blogger-escaped-morningdojistar="" data-blogger-escaped-morningstar="" data-blogger-escaped-move.="" data-blogger-escaped-n1="" data-blogger-escaped-n2="" data-blogger-escaped-n3="" data-blogger-escaped-n4="" data-blogger-escaped-n="" data-blogger-escaped-na="" data-blogger-escaped-needs="" data-blogger-escaped-nimportant="" data-blogger-escaped-nlit="" data-blogger-escaped-nlitwick="" data-blogger-escaped-nnison:="" data-blogger-escaped-nnison:needs="" data-blogger-escaped-nnison:the="" data-blogger-escaped-nverted="" data-blogger-escaped-oming="" data-blogger-escaped-on="" data-blogger-escaped-oncealing="" data-blogger-escaped-oncealingbabyswallow="" data-blogger-escaped-one="" data-blogger-escaped-onneckbearish="" data-blogger-escaped-or="" data-blogger-escaped-orning="" data-blogger-escaped-outside="" data-blogger-escaped-pattern.="" data-blogger-escaped-pattern.white="" data-blogger-escaped-pattern="" data-blogger-escaped-piercingline="" data-blogger-escaped-pigeon.="" data-blogger-escaped-pressure="" data-blogger-escaped-protracted="" data-blogger-escaped-ragonfly="" data-blogger-escaped-reak="" data-blogger-escaped-real="" data-blogger-escaped-reliability:="" data-blogger-escaped-reliability="" data-blogger-escaped-reversal="" data-blogger-escaped-ri-star="" data-blogger-escaped-risingthreemethods="" data-blogger-escaped-river="" data-blogger-escaped-rules="" data-blogger-escaped-s="" data-blogger-escaped-sandwich.="" data-blogger-escaped-second="" data-blogger-escaped-sell="AbandonedBabyBearish" data-blogger-escaped-selling="" data-blogger-escaped-separatinglinesbearish="" data-blogger-escaped-separatinglinesbullish="" data-blogger-escaped-shadow="" data-blogger-escaped-shootingstargap="" data-blogger-escaped-sidebysidewhitelines="" data-blogger-escaped-sidebysidewhitelinesbearish="" data-blogger-escaped-signal.="" data-blogger-escaped-significant.="" data-blogger-escaped-significant="" data-blogger-escaped-small="" data-blogger-escaped-smaller="" data-blogger-escaped-south.="" data-blogger-escaped-star.="" data-blogger-escaped-stars="" data-blogger-escaped-sticksandwich="" data-blogger-escaped-stron="" data-blogger-escaped-stronger="" data-blogger-escaped-swallow.="" data-blogger-escaped-than="" data-blogger-escaped-the="" data-blogger-escaped-third="" data-blogger-escaped-tholdbullish="" data-blogger-escaped-three="" data-blogger-escaped-threeblackcrows="" data-blogger-escaped-threeinsidedownbearish="" data-blogger-escaped-threeinsideup="" data-blogger-escaped-threelinestrike="" data-blogger-escaped-threeoutsidedownbearish="" data-blogger-escaped-threeoutsideup="" data-blogger-escaped-threeriverbottom="" data-blogger-escaped-threestarsinthesouth="" data-blogger-escaped-threewhitesoldiers="" data-blogger-escaped-thrustingbearish="" data-blogger-escaped-tick="" data-blogger-escaped-tops.="" data-blogger-escaped-tops="" data-blogger-escaped-tristarbearish="" data-blogger-escaped-tristarbullish="" data-blogger-escaped-tweezerbottom="" data-blogger-escaped-tweezertop="" data-blogger-escaped-twocrows="" data-blogger-escaped-ullish="" data-blogger-escaped-up.="" data-blogger-escaped-upper="" data-blogger-escaped-upsidegapthreemethods="" data-blogger-escaped-upsidegaptwocrows="" data-blogger-escaped-upsidetasukigap="" data-blogger-escaped-uy="" data-blogger-escaped-verification.="" data-blogger-escaped-very="" data-blogger-escaped-volume="" data-blogger-escaped-white="" data-blogger-escaped-wick="" data-blogger-escaped-writeif="">\nNison: Has more significance if volume of white candle sticks is greater than on black candlesticks.\nLitWick reliability: high.","")+
WriteIf(separatingLinesBullish,"Separating Lines Bullish. \nA continuation pattern.\nNison: \nLitWick reliability: low.","")+
WriteIf(sideBySideWhiteLines,"Side by Side White Lines. \nA continuation pattern.\nNison: If occurring during a downtrend may only be short covering.\nLitWick reliability: high.","")+
WriteIf(threeWhiteSoldiers,"3 White Soldiers. \nA continuation pattern.\nNison: Positive, but be aware of negative similar stalled pattern and advance block pattern.\nLitWick reliability: high.","")+
WriteIf(upsideGapThreeMethods,"Upside Gap 3 Methods. \nA continuation pattern.\nLitWick reliability: moderate.","")+
WriteIf(threeLineStrike,"3 Line Strike. \nA continuation pattern.\nLitWick reliability: low.","")+
WriteIf(tweezerBottom,"Tweezer Bottom.\nA reversal pattern. With other reversal candles it could indicate a support level.\nNison: Needs confirmation.","")+
WriteIf(upsideTasukiGap,"Upside Tasuki Gap. \nA continuation pattern.\nNison: the real bodies of the two candlesticks in the gap should be about the same size.\nLitWick reliability: moderate.","")+
WriteIf(Buy,"\n-------------------------------------------","");; /***************************************
Bearish Candles
********************************************/
WriteIf(Sell,"Bearish\n=======\n","")+
WriteIf(AbandonedBabyBearish,"Abandoned Baby Bearish. \nA reversal pattern.\nNison: Extremely rare.\nLitWick reliability: high.","")+
WriteIf(advanceBlockBearish,"Advancing Block Bearish. \nA reversal pattern.\nNison: Rally is in trouble. Signs of weakening could be progressively smaller white read bodies or relatibvely long upper shadows on the last two white candlesticks.Not necessarily a reversal pattern.\nLitWick Reliability: moderate.","")+
WriteIf(beltHoldBearish,"Belt Hold Bearish. \nA reversal pattern.\nNison: The longer the height of the belt-hold candle the more significant the pattern.\nLitWick reliability: low.","")+
WriteIf(breakAwayBearish,"Break Away Bearish. \nA reversal pattern.\nLitWick reliability: moderate.","")+
WriteIf(darkCloudCover,"Dark Cloud Cover. \nA reversal pattern.\nNison: Factors indicating the importance of this signal are/n1)The greater the penetration of the first candle by the second.\n2)Both candles are marabozus.\n3)The second body opens above a major resistance level.\n4)High volume on the second day.\nLitWick Reliability: high.","")+
WriteIf(deliberationBearish,"Deliberation Bearish. \nA reversal pattern.\nNison: Not a reversal pattern, but a sign the rally is weakening.\nLitWick reliability: moderate.","")+
WriteIf(CounterAttackBearish,"Counter Attack Bearish.\nNison: A potential stalling of the rally.","")+
WriteIf(engulfingBearish,"Engulfing Bearish. \nA reversal pattern.\nNison: Major reversal signal. Factors increasing patterns importance are\n1) The first day has a very small real body and the second day a very large real body.\n2) The pattern apears after a protracted or very fast move.\n3) Heavy volume on the second day.\n4) The second day engulfs more than one real body.\nLitWick reliability: moderate.","")+
WriteIf(eveningDojiStar,"Evening Doji Star \nA reversal pattern.\nNison: Must be confirmed by long black candle.\nLit Wick reliability: high","")+
WriteIf(eveningStar,"Evening Star. \nA reversal pattern.\nNison: Gap between Second AND third bodies does NOT always occur.\nLitWick reliability: High.","")+
WriteIf(HammerBearish,"Bearish Hammer. \nA reversal pattern.\nNison: More bearish if hammer is black. Needs bearish confirmation. A large gap down on the following day would be a good confirmation.","")+
WriteIf(HangingMan,"Hanging Man. \nA reversal pattern.\nNison: Same as bearish hammer with a large gap down the following day.\nLitWick reliability: low.","")+
WriteIf(dragonflyDojiBearish,"Dragonfly Bearish. \nA reversal pattern.\nNison: Same as Hanging Man.\nLitWick reliability: moderate.","")+
WriteIf(HaramiBearish,"Harami Bearish. \nA reversal pattern.\nNison: Not as significant a reversal pattern as hanging man or engulfing.\nLitWick reliability: low.","")+
WriteIf(HaramiCrossBearish,"Harami Cross Bearish. \nA reversal pattern.\nNison: More significant reversal pattern than Harami. Second day can be white or black.\nLitWick reliability: moderate.","")+
WriteIf(idendicalThreeBlackCrows,"Identical 3 Black Crows. \nA reversal pattern in an uptrend.\nNison:Very bearish.\nLitWick reliability: high. ","")+
WriteIf(kickingBearish,"Kicking Bearish. \nA reversal pattern.\nLitWick reliability: high.","")+
WriteIf(MeetingLinesBearish,"Meeting Lines Bearish. \nA reversal pattern.\nNison: \nLitWick reliability: moderate, but not as strong as Dark cloud Cover.","")+
WriteIf(shootingStarGap,"Shooting Star. \nA reversal pattern.\nNison:Not major reversal signal as evening star. Ideally real body would gap away from previous body. Needs to appear after an uptrend.\nLitWick reliability: low.","")+
WriteIf(gravestoneDoji,"Gravestone Doji. \nA reversal pattern.\nNison: more significant if it hits new high.\nLitWick reliability: moderate.","")+
WriteIf(threeInsideDownBearish,"3 Inside Down. \nA reversal pattern.\nNison: \nLitWick reliability: high.","")+
WriteIf(threeoutsideDownBearish,"3 Outside Down. \nA reversal pattern.\nLitWick reliability: high.","")+
WriteIf(triStarBearish,"Tri-Star Bearish. \nA reversal pattern.\nNison: Very significant reversal pattern.\nLitWick reliability: moderate.","")+
WriteIf(twoCrows,"2 Crows. \nA reversal pattern.\nLitWick reliability: moderate.","")+
WriteIf(upsideGapTwoCrows,"Upside Gap 2 Crows. \nA reversal pattern.\nNison:Needs confirmation of a continued reversal on third day.\nLitWick reliability: high.","")+
WriteIf(dojiStarBearish,"Doji Star Bearish. \nA reversal pattern.\nNison: needs confirmation.\nLitWick reliability: moderate.","")+
WriteIf(downsideGapThreeMethods,"Downside Gap 3 Methods. A continuation pattern.\nNison: \nLitWick reliability: moderate.","")+
WriteIf(downsideTasukiGap,"Downside Tasuki Gap. \nA continuation method.\nNison: If last day closes window, continuation pattern is negated.\nLitWick reliability: moderate.","")+
WriteIf(fallingThreeMethods,"Falling 3 Methods. \nA continuation pattern.\nNison: \nLitWick reliability: high.","")+
WriteIf(inNeckBearish,"In Neck Bearish. A continuatin pattern.\nNison: Similar to piercing pattern but bearish because there is no penetration of second day.\nLitWick reliability: moderate.","")+
WriteIf(OnNeckBearish,"On Neck Bearish. \nA continuation pattern. Similar to piercing pattern but bearish beccause there is no penetration of the second day.\nLitWick reliability: moderate.","")+
WriteIf(separatingLinesBearish,"Separating Lines Bearish","");
WriteIf(sideBySideWhiteLinesBearish,"Side by Side White Lines Bearish. \nA continuation pattern.\nNison: very rare.\nLitWick reliability: moderate.","")+
WriteIf(threeBlackCrows,"3 Black Crows. \nA reversal pattern.\nNison: Need to appear after a mature advance.\nLitWick reliability: high.","")+
WriteIf(threeLineStrike,"3 Line Strike. \nA continuation pattern.\nLitWick reliability: low.","")+
WriteIf(thrustingBearish,"Thrusting. \nA continuation pattern.\nNison: Not a reversal day because second day does not pierce midpoint of first day.\nLitWick reliability: low.","")+
WriteIf(tweezerTop,"Tweezer Top. \nA reversal pattern.\nNison: Needs confirmation.","")+
WriteIf(Sell,"\n---------------------------------------------------","");
/***********************************************
End Commentary
************************************************/
_SECTION_END();
_SECTION_BEGIN("Signal Panel");
sp = ParamToggle("Signal Panel","Show|Hide",1);
showsl = ParamToggle("Stop Loss Line", "Show|Hide", 0);
no=6;
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C1;i--)
{
if(Buy[i] == 1)
{
entry = C[i];
sig = "BUY";
sl = s5d[i];
tar1 = entry + (entry * .0050);
tar2 = entry + (entry * .0092);
tar3 = entry + (entry * .0179);
bars = i;
i = 0;
}
if(Sell[i] == 1)
{
sig = "SELL";
entry = C[i];
sl = s5d[i];
tar1 = entry - (entry * .0050);
tar2 = entry - (entry * .0112);
tar3 = entry - (entry * .0212);
bars = i;
i = 0;
}
}
Offset = 20;
Clr = IIf(sig == "BUY", colorLime, colorRed);
ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1));
sl = ssl[BarCount-1];
if (sp == 1 )
{
Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);
Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);
Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);
for (i=bars; i (wbf*arg);
nrb=rg<(nbf*arg);
Vl=VRef(C,-1);
dnbar=CRef(V,-1) AND Ref(V,-1)>Ref(V,-2);
Cloc=C-L;
x=rg/Cloc;
x1=IIf(Cloc==0,arg,x);
Vb=V>Vrg OR V>Ref(V,-1);
ucls=x1<2 data-blogger-escaped-dcls="x1">2;
mcls=x1<2 data-blogger-escaped-.2="" data-blogger-escaped-and="" data-blogger-escaped-x1="">1.8 ;
Vlcls=x1>4;
Vhcls=x1<1 data-blogger-escaped-.35="" data-blogger-escaped-0.8="" data-blogger-escaped-1.8="" data-blogger-escaped-bar...="" data-blogger-escaped-classify="" data-blogger-escaped-dwhighclose="0.7;" data-blogger-escaped-dwhighvol="1.75;" data-blogger-escaped-dwlowclose="0.3;" data-blogger-escaped-dwlowvol="0.75;" data-blogger-escaped-dwmoderatevol="1.10;" data-blogger-escaped-dwnarrowspread="0.8;" data-blogger-escaped-dwspreadmiddle="0.5;" data-blogger-escaped-dwultrahighvol="2;" data-blogger-escaped-dwveryhighvol="1.75;" data-blogger-escaped-dwwidespread="1.8;" data-blogger-escaped-each="" data-blogger-escaped-j="MA(C,5);" data-blogger-escaped-mp="(H+L)/2;" data-blogger-escaped-numdays="Pp1;" data-blogger-escaped-olofdays="" data-blogger-escaped-pp1="Param(" data-blogger-escaped-pp2="Param(" data-blogger-escaped-tll="LinRegSlope(j,40)" data-blogger-escaped-tlm="LinRegSlope(j,15)" data-blogger-escaped-tls="LinRegSlope(j,5);" data-blogger-escaped-umberofdays="" data-blogger-escaped-upbar="C" data-blogger-escaped-volnumdays="Pp2;" data-blogger-escaped-was=""> Ref(C,-1);
downBar = C < Ref(C,-1);
spread = H-L;
avgRange = Sum(spread, numDays) / numDays;
wideRange = spread >= (dwWideSpread * avgRange);
narrowRange = spread <= (dwNarrowSpread * avgRange);
testHighClose = L + (spread * dwHighClose);
testLowClose = L + (spread * dwLowClose);
testCloseMiddle = L + (spread * dwSpreadMiddle);
upClose = C > testHighClose;
downClose = C < testLowClose;
middleClose = C >= testLowClose AND C <= testHighClose;
avgVolume = EMA(V, volNumDays);
highVolume = V > (avgVolume * dwHighVol);
moderateVol= V > (avgVolume * dwmoderateVol);
veryHighVolume = V > (avgVolume * dwVeryHighVol);
ultraHighVolume = V > (avgVolume * dwUltraHighVol);
LowVolume = V < (avgVolume * dwLowVol);
////////////////////////////////////////////////////////////////////////////////////
// direction and title
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
//
// Basic patterns...
//
////////////////////////////////////////////////////////////////////////////////////
upThrustBar = downClose AND H > Ref(H,-1) AND (C == L) AND downClose AND (NOT narrowRange);
noDemandBar = narrowRange AND LowVolume AND upBar AND (NOT upClose);
//noDemandBar = narrowRange AND LowVolume AND upBar AND (V < Ref(V,-1)) AND (V < Ref(V,-2));
noSupplyBar = narrowRange AND LowVolume AND downBar AND (V < Ref(V,-1)) AND (V < Ref(V,-2));
absorption = Ref(downbar, -1) AND Ref(highVolume, -1) AND upBar;
support = Ref(downBar,-1) AND (NOT Ref(downClose,-1)) AND Ref(highVolume,-1) AND upBar;
stoppingVolume = Ref(downBar,-1) AND Ref(highVolume,-1) AND C > testCloseMiddle AND (NOT downBar);
bullishsign=moderateVol+UpThrustBar;//OR moderateVol+upBar;
//rallyEnd = (Ref(highVolume,-1) AND Ref(upBar,-1) AND wideRange AND downBar) OR
// (narrowRange AND highVolume AND H > Ref(HHV(H, 250), -1));
////////////////////////////////////////////////////////////////////////////////////
//
// Strength and Weakness
//
////////////////////////////////////////////////////////////////////////////////////
weakness = upThrustBar OR noDemandBar OR (narrowRange AND (H > Ref(H,-1)) AND highVolume) OR (Ref(highVolume,-1) AND Ref(upBar,-1) AND downBar AND (H < Ref(H,-1)));
/////////////////////////////////////////////////////////////////////////////////////////////
C1 = Ref(C, -1);
uc = C > C1; dc = C <= C1;
ud = C > O; dd = C <= O;
green = 1; blue = 2; yellow = 3; red = 4; white = 5;
VType = IIf(ud, IIf(uc, green, yellow), IIf(dd,IIf(dc, red, blue), white));
/* green volume: up-day and up-close*/
gv = IIf(VType == green, V, 0);
/* yellow volume: up-day but down-close */
yv = IIf(VType == yellow, V, 0);
/* red volume: down-day and down-close */
rv = IIf(VType == red, V, 0);
/* blue volume: down-day but up-close */
bv = IIf(VType == blue, V, 0);
uv = gv + bv; uv1 = Ref(uv, -1); /* up volume */
dv = rv + yv; dv1 = Ref(dv, -1); /* down volume */
/* create moving average period parameters */
VolPer = Param("Adjust Vol. MA per.", 34, 1, 255, 1);
ConvPer = Param("Adjust Conv. MA per.", 9, 1, 255, 1);
/* create triple exponential moving avearges of separate up and down volume
moving averages */
MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1);
MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1);
MAtv = TEMA(V, VolPer );//total volume
/* Switch for Horizontal lines indicating current level of positive and
negative volume for ease in comparing to past highs/lows - toggle via
parmameter window */
OscillatorOnly = Param("Show Oscillator Only", 0, 0, 1, 1);
CompareBullVolume = Param("Show Bull Level", 1, 0, 1, 1);
if(CompareBullvolume AND !OscillatorOnly){
//Plot(SelectedValue(MAuv), "", colorGreen, styleLine);
}
CompareBearVolume = Param("Show Bear Level", 1, 0, 1, 1);
if(CompareBearVolume AND !OscillatorOnly){
//Plot(SelectedValue(MAdv), "", colorRed, styleLine);
}
/* Volume Segment Switches - toggle via parameter window */
bullvolume = Param("Show Bull Volume", 1, 0, 1, 1);
bearvolume = Param("Show Bear Volume", 1, 0, 1, 1);
totalvolume = Param("Show Total Volume", 1, 0, 1, 1);
/* plot volume lines and histograms if toggled on: */
bearToFront = Param("Show Bear Vol in Front", 0, 0, 1, 1);
if(bearToFront AND !OscillatorOnly){
//Plot(MAdv, "", colorRed, styleHistogram|styleNoLabel);
}
if(bullvolume AND !OscillatorOnly){
//Plot(MAuv, "Average Bull Volume", colorGreen, styleHistogram|styleNoLabel);
}
if(bearvolume AND !OscillatorOnly){
//Plot(MAdv, "Average Bear Volume", colorRed, styleHistogram|styleNoLabel);
}
if(totalVolume AND !OscillatorOnly){
//Plot(MAtv, "Total Volume", colorWhite, styleHistogram|styleNoLabel);
//Plot(MAtv, "", colorWhite, styleLine);
}
if(bullvolume AND !OscillatorOnly){
//Plot(MAuv, "", colorGreen, styleLine);
}
if(bearvolume AND !OscillatorOnly){
//Plot(MAdv, "", colorRed, styleLine);
}
/* better visibility of zero line: */
//Plot(0, "", colorBlue, 1);
/* Rise/Fall Convergence variables: */
Converge = (TEMA(MAuv - MAdv, ConvPer));
Converge1 = Ref(Converge, -1);
ConvergeUp = Converge > Converge1;
ConvergeOver = Converge > 0;
rising = ConvergeUp AND ConvergeOver;
falling = !ConvergeUp AND ConvergeOver;
/* Rise/Fall Convergence Oscillator Switch - toggle via parameter window - (provides a better view of resulting combination of battling bull/bear volume forces) */
convergenceOscillator = Param("Show Oscillator", 0, 0, 1, 1);
if(convergenceOscillator OR OscillatorOnly){
//Plot(Converge, "Bull/Bear Volume Convergence/Divergence", colorViolet,1|styleLeftAxisScale|styleNoLabel|styleThick);
//Plot(0,"", colorYellow, 1|styleLeftAxisScale|styleNoLabel);
}
/********************************************************
Convergence Rise/Fall Shadows:
(provides a more easily visible display of rising and falling bull/bear volume convergence) - toggle via parameter window
-posiitive Volume exceeding negative Volume: Light shadow
-negative volume exceeding positive volume: dark shadow
-if you use standard gray background - best shadows are:
-my greys: 14 = (216, 216, 216); 15 = (168, 168, 168));
-best substitute? using AB color constants?
-light: colorpalegreen; dark: colorRose;?
-(depends on your color scheme - customize to your tastes)
**********************************************************/
/* uncomment if you use my custom color greys: */
riseFallColor = IIf(rising, 14,15); //my custom shadow greys
/* comment out if you use my custom color gray shadows: */
/* riseFallColor = IIf(rising, colorPaleGreen,colorRose); */
/* Rise/Fall Convergence Plot Switch - toggle via parameter window */
riseFallShadows = Param("Show RiseFallShadows", 0, 0, 1, 1);
if(riseFallShadows){
//Plot(IIf(rising OR falling, 1, 0), "", riseFallColor,styleHistogram|styleArea|styleOwnScale|styleNoLabel);
}
_SECTION_END();
_SECTION_BEGIN("Pivot Finder");
/***********************************
Code to automatically identify pivots
***********************************/
// -- what will be our lookback range for the hh and ll?
farback=Param("How Far back to go",100,50,5000,10);
nBars = Param("Number of bars", 12, 5, 40);
//"BIdxJJJ = " + BarIndex() + "\n" + "OGGGGGGGGGGG = " + O + "\n"+"H = "+ H + "\n"+"L = " + L + "\n"+"C " ;
GraphXSpace=7;
// -- Create 0-initialized arrays the size of barcount
aHPivs = H - H;
aLPivs = L - L;
// -- More for future use, not necessary for basic plotting
aHPivHighs = H - H;
aLPivLows = L - L;
aHPivIdxs = H - H;
aLPivIdxs = L - L;
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
aHHVBars = HHVBars(H, nBars);
aLLVBars = LLVBars(L, nBars);
aHHV = HHV(H, nBars);
aLLV = LLV(L, nBars);
aVisBars = Status("barvisible");
nLastVisBar = LastValue(Highest(IIf(aVisBars, BarIndex(), 0)));
_TRACE("Last visible bar: " + nLastVisBar);
// -- Initialize value of curTrend
curBar = (BarCount-1);
curTrend = "";
if (aLLVBars[curBar] <
aHHVBars[curBar]) {
curTrend = "D";
}
else {
curTrend = "U";
}
if (BarCount > farback)
{
for (i=0; i lastHPIdx) {
// -- Bar and price info for candidate pivot
candIdx = curBar - aHHVBars[curBar];
candPrc = aHHV[curBar];
if (
lastHPH < candPrc AND
candIdx > lastLPIdx AND
candIdx < curBar) {
// -- OK, we'll add this as a pivot...
aHPivs[candIdx] = 1;
// ...and then rearrange elements in the
// pivot information arrays
for (j=0; j candPrc AND
candIdx > lastHPIdx AND
candIdx < curBar) {
// -- OK, we'll add this as a pivot...
aLPivs[candIdx] = 1;
for (j=0; j ADX(range);
// ADX Trends
Notrend = ADX(range) < 20;
ModerateTrend = ADX(range) >= 20 AND ADX(range) < 40 AND up_adx ;
StrongTrend = ADX(range) >= 40 AND ADX(range) < 60 AND up_adx ;
VeryStrongTrend = ADX(range) >= 60 AND ADX(range) < 80 AND up_adx ;
ExtremelyStrongTrend = ADX(range) >= 80 AND up_adx ;
// Buy Conditions
bcon1 = Cross(px,ax) AND nx < px AND ax > Ref(ax,-1);
scon1 = Cross(nx,ax) AND px < nx AND ax > Ref(ax,-1);
adbuy = ax < 20 AND ax > Ref(ax,-1) AND ( Cross(px,nx) OR nx < px) ;
adsell = ax < 20 AND ax > Ref(ax,-1) AND ( Cross(nx,px) OR nx > px) ;
adbuy1 = Cross(px,ax) AND nx < px AND ax > Ref(ax,-1) AND px > ax;
adsell1 = Cross(nx,ax) AND nx > px AND ax > Ref(ax,-1) AND nx > ax;
BUY_ADX = bcon1 + adbuy + adbuy1;
SELL_ADX = scon1 + adsell + adsell1;
ADX_status = WriteIf(BUY_ADX,"Buy["+BUY_ADX+"]",WriteIf(SELL_ADX,"Sell["+SELL_ADX+"]","NA"));
ADX_col = IIf (BUY_ADX,colorGreen, IIf (SELL_ADX,colorRed,colorLightGrey));
/**********************************************************
/MACD Cross
***********************************************************/
_SECTION_BEGIN("MACD");
MACD_TOGGLE = ParamToggle("Plot MACD","Off|On",0);
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
m1 = MACD(r1, r2);
s1 = Signal(r1,r2,r3);
difference = m1-s1;
mycolor=IIf(m1<0 data-blogger-escaped-and="" data-blogger-escaped-m1="">s1,51,IIf(m1>0 AND m1>s1,colorBrightGreen,IIf(m1>0 AND m1 0;
BEAR_CROSS_ABOVE_ZERO = Cross (Signal(r1,r2,r3),MACD(r1, r2)) AND MACD(r1, r2) > 0;
// **********************
//bELOW ZERO Bullish - Bearish MACD crossing signal above zero or below zero plane
BULL_CROSS_BELOW_ZERO = Cross (MACD(r1, r2),Signal(r1,r2,r3)) AND MACD(r1, r2)<0 data-blogger-escaped-10="" data-blogger-escaped-1="" data-blogger-escaped-200="" data-blogger-escaped-5="" data-blogger-escaped-6="" data-blogger-escaped-_default_name="" data-blogger-escaped-_section_begin="" data-blogger-escaped-_section_end="" data-blogger-escaped-and="" data-blogger-escaped-avg="" data-blogger-escaped-bear_cross_above_zero="" data-blogger-escaped-bear_cross_below_zero="" data-blogger-escaped-bear_hook1="BarsSince(BULL_CROSS_ABOVE_ZERO);" data-blogger-escaped-bear_hook="" data-blogger-escaped-bear_zlr1="" data-blogger-escaped-bear_zlr="BarsSince(B_MACD_0);" data-blogger-escaped-bull_cross_above_zero="" data-blogger-escaped-bull_cross_below_zero="" data-blogger-escaped-bull_hook1="BarsSince(BEAR_CROSS_ABOVE_ZERO);" data-blogger-escaped-bull_hook="" data-blogger-escaped-bull_zlr1="" data-blogger-escaped-bull_zlr="BarsSince(S_MACD_0);" data-blogger-escaped-buy_macd="B_MACD_0" data-blogger-escaped-colorgreen="" data-blogger-escaped-colorlightgrey="" data-blogger-escaped-colorpalegreen="" data-blogger-escaped-colorred="" data-blogger-escaped-colorturquoise="" data-blogger-escaped-dsmooth="" data-blogger-escaped-ell="" data-blogger-escaped-eriods="" data-blogger-escaped-ero="" data-blogger-escaped-ff="" data-blogger-escaped-graphx="5;" data-blogger-escaped-if="" data-blogger-escaped-iif="" data-blogger-escaped-ksmooth="" data-blogger-escaped-level="" data-blogger-escaped-line="" data-blogger-escaped-lot="" data-blogger-escaped-macd="" data-blogger-escaped-macd_col="IIf" data-blogger-escaped-macd_status="WriteIf(BUY_MACD," data-blogger-escaped-n="" data-blogger-escaped-olord="" data-blogger-escaped-olork="" data-blogger-escaped-overbought="80;" data-blogger-escaped-oversold="20;" data-blogger-escaped-paramcolor="" data-blogger-escaped-paramstyle="" data-blogger-escaped-plot="" data-blogger-escaped-r1="" data-blogger-escaped-r2="" data-blogger-escaped-reject="" data-blogger-escaped-riteif="" data-blogger-escaped-sell_macd="S_MACD_0" data-blogger-escaped-smooth="" data-blogger-escaped-sp="" data-blogger-escaped-stoc_toggle="ParamToggle(" data-blogger-escaped-stochastics="" data-blogger-escaped-stochbuy="Cross(StochK(SP,Ksmooth)," data-blogger-escaped-stochd="" data-blogger-escaped-stochdval="StochD(" data-blogger-escaped-stochk="" data-blogger-escaped-stochkval="StochK(" data-blogger-escaped-tochd="" data-blogger-escaped-tyle="" data-blogger-escaped-uy="" data-blogger-escaped-verbought="" data-blogger-escaped-versold="" data-blogger-escaped-zlr=""> 20) AND (StochK(SP,Ksmooth) > 20) AND (StochD(SP,Ksmooth, DSmooth) < 80) AND (StochK(SP,Ksmooth) < 80);
StochSell = Cross (StochD(SP,Ksmooth, DSmooth), StochK(SP,Ksmooth)) AND (StochD(SP,Ksmooth, DSmooth) > 20) AND (StochK(SP,Ksmooth) > 20) AND (StochD(SP,Ksmooth, DSmooth) < 80) AND (StochK(SP,Ksmooth) < 80);
StochStrongBuy = Cross(StochK(SP,Ksmooth),StochD(SP,Ksmooth, DSmooth)) AND (StochD(SP,Ksmooth, DSmooth) < 20) AND (StochK(SP,Ksmooth) < 20) ;
StochStrongSell = Cross (StochD(SP,Ksmooth,DSmooth), StochK(SP , Ksmooth)) AND (StochD(SP,Ksmooth, DSmooth) > 80) AND (StochK(SP,Ksmooth) > 80);
BUY_STOCH = StochBuy + StochStrongBuy;
SELL_STOCH = StochSell + StochStrongSell;
printf("Sto %g",BUY_STOCH);
_SECTION_END();
STOCH_status = WriteIf(BUY_STOCH,"Buy["+BUY_STOCH+"]",WriteIf(SELL_STOCH,"Sell["+SELL_STOCH+"]","NA"));
STOCH_col = IIf (BUY_STOCH,colorGreen, IIf (SELL_STOCH,colorRed,colorLightGrey));
/**************************************************
TREND DETECTOR
***************************************************/
_SECTION_BEGIN("Trend Detector");
TREND_TOGGLE = ParamToggle("Plot Trend","Off|On",0);
A = (H+C+L)/3;
B=MA(A,5)-EMA(A,34);
D = EMA(A,34)-MA(A,5);
Bcolor=IIf(B>D,25,39);
Dcolor=IIf(D D;
down = B < D;
TREND_B = Cross(B,D);
TREND_S = Cross(D,B);
if(TREND_TOGGLE==1)
{
Plot(B,"B ",Bcolor,styleLine|styleThick);
Plot(D,"D ",Dcolor,styleLine|styleThick);
Plot(B,"",Bcolor,styleHistogram|styleThick);
Plot(D,"",Dcolor,styleHistogram|styleThick);
Plot(0,"",colorWhite,styleLine);
PlotShapes(IIf(TREND_S, shapeHollowDownArrow , shapeNone), colorRed,0,0,-8);
PlotShapes(IIf(TREND_B, shapeHollowUpArrow , shapeNone), colorGreen,0,0,-8);
}
_SECTION_END();
TREND_status = WriteIf(TREND_B,"Buy",WriteIf(TREND_S ,"Sell","NA"));
TREND_col = IIf (TREND_B,colorGreen, IIf (TREND_S ,colorRed,colorLightGrey));
/**************************************************
RSI
***************************************************/
_SECTION_BEGIN("RSI");
Rperiods = Param( "Periods", 14, 1, 200, 1 );
OB = Param("OverBrought Line",70,70,100,1);
OS = Param("OverSold Line",30,20,40,1);
CentreRSI = 50;
Overbought = OB;
Oversold = OS;
RSI_PERIODS = Prec(RSI( Rperiods),1);
//******* RSI Cross 30 or 70**//
B_RSI = RSI_CROSS_30 = Cross(RSI_PERIODS,OS);
S_RSI = RSI_CROSS_70 = Cross(OB,RSI_PERIODS);
//******* RSI < 30 or > 70**//
RSI_BELOW_30 = RSI_PERIODS < OS ;
RSI_ABOVE_70 = RSI_PERIODS > OB ;
//******* RSI > OR < IN LAST 14 DAYS***//
RSI_14_GREATEST = RSI_PERIODS>=HHV( RSI_PERIODS, 14);
RSI_14_LOWEST = RSI_PERIODS<=LLV( RSI_PERIODS, 14);
//******* RSI DIVERGENCE***//
RSI_BEAR_DIV = Close >= HHV( Close, 14 ) AND RSI_PERIODS < HHV( RSI_PERIODS, 14 );
RSI_BULL_DIV = RSI_PERIODS >= HHV( RSI_PERIODS, 14 ) AND Close < HHV( Close, 14 );
RSI_BULL_DIV1 = Close <= LLV( Close, 14 ) AND RSI_PERIODS > LLV(RSI_PERIODS, 14 );
RSI_BEAR_DIV1 = RSI_PERIODS <= LLV( RSI_PERIODS, 14) AND Close > LLV(Close,14);
/*****/////////
RSI_BUY = B_RSI ;
RSI_SELL =S_RSI ;
_SECTION_END();
RSI_status = WriteIf(RSI_BUY,"Buy["+RSI_BUY+"]",WriteIf(RSI_SELL,"Sell["+RSI_SELL+"]","NA"));
RSI_col = IIf (RSI_BUY,colorGreen, IIf (RSI_SELL,colorRed,colorLightGrey));
/**************************************************
OBV
***************************************************/
_SECTION_BEGIN("OBV");
MA_OBV_Period = Param("OBV_MA Period",10,10,21,1);
/***********OBV CROSS MA************/
OBV_BUY = Cross(OBV(),MA(OBV(),MA_OBV_Period));
OBV_SELL = Cross(MA(OBV(),MA_OBV_Period),OBV());
_SECTION_END();
OBV_status = WriteIf(OBV_BUY,"Buy",WriteIf(OBV_SELL,"Sell","NA"));
OBV_col = IIf (OBV_BUY,colorGreen, IIf (OBV_SELL,colorRed,colorLightGrey));
/**************************************************
TSV = SIMILAR TO WORDEN
***************************************************/
_SECTION_BEGIN("TSV");
Period = Param("Period for FVE", 22, 5, 80, 1 );
Coeff = Param("Coeff for Cutoff", 0.1, 0, 2, 0.01 );
intra=log(H)-log(L);
Vintra = StDev(intra, period );
inter = log(Avg)-log(Ref(Avg,-1));
Vinter = StDev(inter,period);
Cutoff = Coeff * (Vinter+Vintra)*C;
MF = C- (H+L)/2 + Avg - Ref( Avg, -1 );
VC = IIf( MF > Cutoff, V,
IIf( MF < -Cutoff, -V, 0 ));
FVE = 100 * Sum( VC, Period )/(MA( V, Period ) * Period );
// Momemtum Indicator by William Blau
TSI = 100 * ( EMA( EMA( C - Ref( C, -1 ) ,25 ) ,13)
/ EMA( EMA( abs( C - Ref( C, -1) ),25 ), 13 ) );
TSI_BUY = Cross(TSI,EMA(TSI,7));
TSI_SELL = Cross(EMA(TSI,7),TSI);
_SECTION_END();
TSI_status = WriteIf(TSI_BUY,"Buy",WriteIf(TSI_SELL,"Sell","NA"));
TSI_col = IIf (TSI_BUY,colorGreen, IIf (TSI_SELL,colorRed,colorLightGrey));
/**************************************************
TRIX
***************************************************/
_SECTION_BEGIN("TRIX");
// TRIX - 15 Periods, 9 Signal Periods
tPeriods = Param("Periods", 15, 2, 100, 1 );
tSig = Param("Signal", 9, 2, 100, 1);
Zero = 0;
TRIX_VAL = Trix(tPeriods);
SIG_TRIX = EMA(Trix(tPeriods),tSig);
/***********TRIX & Signal Line cross ************/
TRIX_SIGNAL_BUY = Cross(TRIX_VAL, SIG_TRIX) AND TRIX_VAL < 0;
TRIX_SIGNAL_SELL = Cross(SIG_TRIX, TRIX_VAL)AND TRIX_VAL > 0;
/***********TRIX & Zero Line cross ************/
TRIX_ZERO_BUY = Cross(TRIX_VAL, Zero);
TRIX_ZERO_SELL = Cross(Zero, TRIX_VAL);
TRIX_BUY = TRIX_SIGNAL_BUY + TRIX_ZERO_BUY;
TRIX_SELL = TRIX_SIGNAL_SELL + TRIX_ZERO_SELL;
_SECTION_END();
TRIX_status = WriteIf(TRIX_BUY,"Buy",WriteIf(TRIX_SELL,"Sell","NA"));
TRIX_col = IIf (TRIX_BUY,colorGreen, IIf (TRIX_SELL,colorRed,colorLightGrey));
/************************************************
Gap
*************************************************/
GAP_UP = GapUp();
GAP_DW = GapDown();
GAP_status = WriteIf(GAP_UP,"Buy",WriteIf(GAP_DW ,"Sell","NA"));
GAP_col = IIf (GAP_UP,colorGreen, IIf (GAP_DW ,colorRed,colorLightGrey));
/************************************************
Total of Bullish/Bearish
*************************************************/
Total_Buy = PIVOT_BUY + BUY_ADX + BUY_MACD + BUY_STOCH+ TREND_B + GAP_UP + RSI_BUY + OBV_BUY + TSI_BUY + TRIX_BUY;
Total_Sell = PIVOT_SELL + SELL_ADX + SELL_MACD + SELL_STOCH + TREND_S + GAP_DW + RSI_SELL + OBV_SELL +TSI_SELL+TRIX_SELL;
printf("B OIVOTS %g\n",PIVOT_BUY);
printf("SELL PIVOTS %g\n",PIVOT_SELL);
printf("BUY GAP %g\n",TREND_B);
printf("BUY TREND %g\n",GAP_UP);
printf("BUY RSI %g\n",B_RSI + RSI_14_GREATEST + RSI_BULL_DIV1 + RSI_BULL_DIV);
_SECTION_BEGIN("Chart Settings");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartBkGradientFill(ParamColor("Upper Chart",colorDarkGrey),ParamColor("Lower Chart",colorDarkGrey));
GraphXSpace=Param("GraphXSpace",10,0,100,1);
dec = (Param("Decimals",2,0,7,1)/10)+1;
bi = BarIndex();
Lbi = LastValue(BarIndex());
sbi = SelectedValue(bi);
x1= BarCount-1;
Title = EncodeColor(55)+ Name() + " " + EncodeColor(32) + Date() + " " + EncodeColor(5) + "{{INTERVAL}} " +
EncodeColor(55)+ " Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
EncodeColor(55)+ " High = "+ EncodeColor(5) + WriteVal(H,dec) +
EncodeColor(55)+ " Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
EncodeColor(55)+ " Close = "+ EncodeColor(52)+ WriteVal(C,dec)+
EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal(V,1) +
"\n" + EncodeColor(colorYellow) + "----------------------------------------"
+ "\n"+EncodeColor(colorGold)+ " Analysis "
+"\n"+EncodeColor(colorYellow) +"----------------------------------------"
///// PIVOTS
+ "\n"
+EncodeColor(colorWhite)+"PIVOTS = " +
WriteIf (aLPivs,EncodeColor(ColorRGB(168,255,0))+" BUY("+PIVOT_BUY+")",WriteIf (aHPivs,EncodeColor(colorRed)+ " SELL("+PIVOT_SELL+")","Neutral"))
///// ADX
+ "\n"+EncodeColor(colorWhite)+"ADX = " +
WriteIf (BUY_ADX,EncodeColor(ColorRGB(168,255,0))+"BUY("+BUY_ADX+")",WriteIf (SELL_ADX,EncodeColor(colorRed)+ " SELL("+SELL_ADX+")","Neutral"))
///// MACD
+ "\n" +EncodeColor(colorWhite)+"MACD "+"["+r1+"]"+" " +"["+r2+"]"+" " +"["+r3+"] = " +
WriteIf (BUY_MACD,EncodeColor(ColorRGB(168,255,0))+"BUY("+BUY_MACD+")",WriteIf (SELL_MACD,EncodeColor(colorRed)+ "SELL("+SELL_MACD+")","Neutral"))
///// STOChASTICS
+"\n"+EncodeColor(colorWhite)+"Stochastics = "
+ WriteIf(BUY_STOCH,EncodeColor(ColorRGB(168,255,0))+"BUY ("+BUY_STOCH+")",WriteIf(SELL_STOCH,EncodeColor(colorRed)+"SELL("+SELL_STOCH+")","Neutral"))
///// RSI
+"\n" + EncodeColor(colorWhite)+"RSI"+"("+Rperiods+") = "
+WriteIf(B_RSI,EncodeColor(ColorRGB(168,255,0))+"BUY("+RSI_BUY+")",WriteIf (S_RSI,EncodeColor(colorRed)+"SELL("+RSI_SELL+")","Neutral"))
///// OBV
+"\n" +EncodeColor(colorWhite)+"OBV = "+
WriteIf(OBV_BUY,EncodeColor(ColorRGB(168,255,0))+"BUY(1)",WriteIf(OBV_SELL,EncodeColor(colorRed)+"SELL(1)",""))+
WriteIf(NOT OBV_BUY AND NOT OBV_SELL,"No Cross","")
///// TSV
+"\n"
+EncodeColor(colorWhite)+"TSV = " +
WriteIf(TSI_BUY,EncodeColor(ColorRGB(168,255,0))+"BUY(1)",
WriteIf(TSI_SELL,EncodeColor(colorRed)+"SELL(1)",""))+
WriteIf(NOT TSI_BUY AND NOT TSI_SELL,EncodeColor(colorAqua)+"NA","")
///// TRIX
+"\n"
+EncodeColor(colorWhite)+"TRIX "+ "("+tPeriods+") "+"(" +tSig+ ") = "
+EncodeColor(ColorRGB(168,255,0))+
WriteIf (TRIX_BUY, "BUY ("+TRIX_BUY+")","")
+EncodeColor(colorRed)+
WriteIf (TRIX_SELL, "SELL("+TRIX_SELL+")","")
+EncodeColor(colorAqua)+
WriteIf (NOT TRIX_SELL AND NOT TRIX_BUY, "No Cross","")
///// TREND
+"\n" +EncodeColor(colorWhite)+"Trend = "
+WriteIf(Up AND NOT TREND_B,EncodeColor(ColorRGB(168,255,0))+"Up ",WriteIf(Up AND TREND_B,EncodeColor(colorBrightGreen)+ "BUY(1)",
WriteIf(Down AND NOT TREND_S,EncodeColor(colorRed)+"Down",WriteIf(Down AND TREND_S,EncodeColor(colorRed)+"SELL(1)","."))))
///// GAPS
+"\n"+EncodeColor(colorWhite)+"GAP = "
+WriteIf(GAP_UP,EncodeColor(ColorRGB(168,255,0))+"UP (1)",WriteIf(GAP_DW,EncodeColor(colorRed)+"DOWN (1)", EncodeColor(colorAqua)+"Neutral"))
+"\n"+EncodeColor(colorPink) +"======================="
+"\n"+EncodeColor((ColorRGB(242,157,255)))+"BUY = "+EncodeColor(colorYellow)+Total_Buy
+"\n"+EncodeColor((ColorRGB(242,157,255)))+"SELL = "+EncodeColor(colorYellow)+Total_Sell
+"\n"+EncodeColor(colorPink) +"----------------------------------------"
+"\n"+EncodeColor(07)+"Volume: "+WriteIf(V>Vp2,EncodeColor(colorLime)+"Very High",WriteIf(V>Vp1,EncodeColor(colorLime)+" High",WriteIf(V>Vrg,EncodeColor(colorLime)+"Above Average",
WriteIf(VVn1,EncodeColor(colorRed)+"Less than Average",WriteIf(V(arg*2),EncodeColor(colorLime)+" Wide",WriteIf(rg>arg,EncodeColor(colorLime)+" Above Average",EncodeColor(colorRed)+" Narrow"))
+"\n"+(EncodeColor(colorYellow)+"Close: ")+WriteIf(Vhcls,EncodeColor(colorLime)+"Very High",WriteIf(ucls,EncodeColor(colorLime)+"High",WriteIf(mcls,EncodeColor(colorYellow)+"Mid",
WriteIf(dcls,EncodeColor(colorRed)+"Down","Very Low"))))
+"\n"+EncodeColor(colorYellow) + "Zone : " +WriteIf(rising , EncodeColor(colorBrightGreen) + "Accumulation",WriteIf(falling , EncodeColor(colorCustom12) + "Distirbution",EncodeColor(colorAqua) + "Flat")) + " "
+"\n"+EncodeColor(colorYellow) + "Status : " +
WriteIf(Weakness , EncodeColor(colorRed) + "Weak",
WriteIf(stoppingVolume , EncodeColor(colorCustom12) + "StoppingVol",
WriteIf(noSupplyBar , EncodeColor(colorLightOrange) + "NoSupply",
WriteIf(support , EncodeColor(colorLightBlue) + "SupportVol",
WriteIf(noDemandBar , EncodeColor(colorPink) + "NoDemand",
WriteIf(absorption, EncodeColor(colorSkyblue) + "Absorption",
WriteIf(upThrustBar, EncodeColor(colorBlue) + "Upthrust",
WriteIf(bullishsign, EncodeColor(colorPaleGreen) + "STRONG",
EncodeColor(colorTan) + "Neutral")))))))) + " "
+"\n"+EncodeColor(colorPink)+"----------------------------------------";
_SECTION_END();
//========================================================================
SetChartOptions(2,chartShowArrows|chartShowDates|chartWrapTitle);
SetChartOptions(0,chartShowArrows|chartShowDates);
//GfxGradientRect( 180, 30, 1759, 735, ColorRGB(40,40,40), ColorRGB(0,0,40) );
GfxSetOverlayMode(1);
//GfxSelectPen( ColorRGB(150,0,0), 1 );
GfxSelectSolidBrush( ColorRGB(0,0,40) );
//GfxRectangle=( 0,750, 1807, 35 );
//GfxSelectPen( ColorRGB(150,0,0), 2 );
GfxSelectSolidBrush( ColorRGB(65,65,65) );
//GfxPolygon(250,200,200,250,250,20,200,50);
//GfxSelectPen( ColorRGB(125,0,0), 1 );
//GfxSelectSolidBrush( ColorRGB(0,0,40) );
//GfxRectangle( 10,100, 190, 160 );
//GfxSelectPen=( ColorRGB(0,0,0) ,1 );
GfxSelectSolidBrush( ColorRGB(0,0,0) );
//GfxSetTextAlign( 250 );// center alignment
GfxSetOverlayMode(1);
//GfxSelectFont=("Times New Roman", 30, 400, True );
GfxSetTextColor( ColorRGB( 105, 105, 105 ) );
GfxSetBkMode(0); // transparent
//GfxTextOut=("Pathfinder", 15 , 35 );
_SECTION_BEGIN("Flower");
si=Param("Zoom/In Out",5,-50,100,1);
GraphXSpace=si;
r1 = Param( "ColorFast avg", 5, 2, 200, 1 );
r2 = Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 = Param( "ColorSignal avg", 5, 2, 200, 1 );
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 data-blogger-escaped-and="" data-blogger-escaped-m1="">s1, ColorRGB(155,155,155),IIf(m1>0 AND m1>s1,ColorRGB(0,125,0),IIf(m1>0 AND m1Open,ColorRGB(0,245,0),ColorRGB(255,0,0));
Ctmpl = E_TSKPCOLORTMPL(Open,High,Low,Close,Volume);
total = 0;
total = total + IIf(tskp_colortmplcnd0 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd1 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd2 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd3 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd4 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd5 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd6 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd7 > 0, 1, -1);
total = total + IIf(tskp_colortmplcnd8 > 0, 1, -1);
for( i = 0; i < BarCount; i++ )
{
if( total[i] >= 5 )
Color[i] = colorLime;
else if( total[i] <= -5 )
Color[i] = colorRed;
else
Color[i] = colorWhite;
}
Candle=ParamList("Candle","Modified Candlestick,Modified Heikin Ashi,Normal Candlestick",1);
if(Candle=="Modified Candlestick")
{
ColorHighliter = myColor;
SetBarFillColor( ColorHighliter );
Plot (Close,"- Modified Candlestick", Color,ParamStyle( "Style", styleCandle|styleLine | styleThick, maskAll));
}
if(Candle=="Modified Heikin Ashi")
{
ColorHighliter = myColor;
SetBarFillColor( ColorHighliter );
PlotOHLC( IIf(flowerOpen 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd1 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd2 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd3 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd4 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd5 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd6 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd7 > 0, 1, -1);
sctotal = sctotal + IIf(tskp_colortmplcnd8 > 0, 1, -1);
for (curBar=0; curBar < BarCount-1; curBar++)
{
if ( curBar == 0 )
{
CHiPr = flowerHigh[curBar];
CHiBar = curBar;
CLoPr = flowerLow[curBar];
CLoBar = curBar;
blsLong = 0;
blsShort = 0;
blsNewCO = 0;
PrePP = 0;
PrevCOBar = 0;
PrevHiVal = flowerHigh[curBar];
PrevLowVal = flowerLow[curBar];
BuySig = 0;
SellSig = 0;
blsLL = 0;
}
if (flowerHigh[CurBar] >= CHiPr) {
CHiPr = flowerHigh[CurBar];
ChiBar = CurBar;
}
if (flowerLow[CurBar] <= CLoPr) {
CLoPr = flowerLow[CurBar];
CLoBar = CurBar;
}
if ( (KPA900Val[curBar] >= KPAutoStopVal[curbar]) AND (PrePP != -1) AND (blsLong != 1) ){
BarDif = CurBar - PrevCOBar;
if (BarDif >= NumBars) {
blsLong = 1;
blsShort = 0;
blsNewCO = 1;
PrevCOBar = CurBar;
}
}
if ( (KPA900Val[curBar] <= KPAutoStopVal[curbar]) AND (PrePP != 1) AND (blsShort != 1) ){
BarDif = CurBar - PrevCOBar;
if (BarDif >= NumBars) {
blsLong = 0;
blsShort = 1;
blsNewCO = 1;
PrevCOBar = CurBar;
}
}
if ( (blsNewCO == 1) AND (sctotal[CurBar] >= 5) AND (blsLong == 1) ) {
LVal = CurBar - CLoBar;
for (j= CLoBar-1; j <= CLoBar+1; j++)
{
if (j >=0) {
aLPivs[j] = 1;
aLoVal[j] = CLoPr;
}
}
PrePP = -1;
blsNewCO = 0;
CHiPr = flowerHigh[CurBar];
CHiBar = CurBar;
CLoPr = flowerLow[Curbar];
CLoBar = CurBar;
}
else if ((blsNewCO == 1) AND (sctotal[CurBar] <= -5) AND (blsShort == 1) ) {
HVal = CurBar - CHiBar;
for (j= CHiBar-1; j <= CHiBar+1; j++)
{
if (j >=0) {
aHPivs[j] = 1;
aHiVal[j] = CHiPr;
}
}
PrePP = 1;
blsNewCO = 0;
CHiPr = flowerHigh[CurBar];
CHiBar = CurBar;
CLoPr = flowerLow[Curbar];
CLoBar = CurBar;
}
}
PlotShapes(IIf(aHPivs == 1, 21,shapeNone), ColorRGB(255,0,145),0, aHiVal,Offset = 20);
PlotShapes(IIf(aHPivs == 1, 15,shapeNone), ColorRGB(200,50,75),0, aHiVal,Offset = 20);
PlotShapes(IIf(aLPivs == 1, 21,shapeNone), ColorRGB(0,125,225),0, aLoVal, Offset = -20);
PlotShapes(IIf(aLPivs == 1, 15,shapeNone), ColorRGB(0,125,255),0, aLoVal, Offset = -20);
}
_SECTION_END();
_SECTION_BEGIN("Resistance");
supres=ParamToggle("Sup_Res","No|Yes",1);
if(supres)
{
Prd1=Param("Res_Period1",2,0,200,1);
test = TEMA ( High , Prd1 ) ;
PK = test > Ref(test,-1) AND Ref(test,1) < High;//Peak
PKV0 = ValueWhen(PK,flowerHigh,0);//PeakValue0
PKV1 = ValueWhen(PK,flowerHigh,1);//PeakValue1
PKV2 = ValueWhen(PK,flowerHigh,2);//PeakValue2
MPK = PKV2 < PKV1 AND PKV1 > PKV0 ;//MajorPeak
RsColor=ParamColor("ResistColor",ColorRGB(225,0,0));
BrCount=Param("ResistBarLength",8,1,500,1);
for (i=0;i Low AND test2 < Ref(test2,-1);//Peak
SPV0 = ValueWhen(SP,flowerLow,0);//PeakValue0
SPV1 = ValueWhen(SP,flowerLow,1);//PeakValue1
SPV2 = ValueWhen(SP,flowerLow,2);//PeakValue2
MSP = SPV2 > SPV1 AND SPV1 < SPV0 ;//MajorPeak
SpColor=ParamColor("SupColor",ColorRGB(0,225,0));
BrCount=Param("SupBarLength",8,1,500,1);
for (i=0;ibuffer_line_down[i-1] && !IsEmpty(buffer_line_down[i-1]))
{
phase = PHASE_BUY;
buffer_line_up[i] = band_lower;
buffer_line_up[i-1] = buffer_line_down[i-1];
}
if(phase!=PHASE_SELL && Close[i]buffer_line_up[i-1])
{
buffer_line_up[i] = band_lower;
}
else
{
buffer_line_up[i] = buffer_line_up[i-1];
}
}
if(phase==PHASE_SELL && ((TrendMode==0 && !IsEmpty(buffer_line_down[i-2])) || TrendMode==1) )
{
if(band_upperC,colorTurquoise,colorGold);
Plot(Betastops, "BATS", colorBATS,ParamStyle("Style1",styleThick,maskAll));
_SECTION_END();
_SECTION_BEGIN("HAS MTF");
/*
Created by chandrakant
Modified on 120309..credit goes to of Karthik sir
1. Here are some observations to keep in mind that will help assure
you are in a good trending move which is detrimental to the success
of the trade moving higher before the inevitable over exhausted trend.
2 Consider only going long on the 5M if the 30M (two rows above) is also blue.
3 Consider the 1hr row as well being blue since it has an effect too.
4 The 15M row has to be blue with NO exceptions
5 The 30M row if blue has less effect on the trade as compared to the 15M row
but keep this in mind. The 30M row being blue helps the 15M row continue to stay blue.
6 The 1hr row has even less effect OR importance but it too keeps the 30M
from weakening to some minor degree.
*/
// Define label bar (x) position location
blankRightBars = 5; //insert actual blank right bars specified in Preferences
barsInView = Status("lastvisiblebarindex") - Status("firstvisiblebarindex") - blankRightBars;
Offset = Param("Offset Bar", 0.95, 0, 1, 0.01);
textOffset = BarCount - (Offset * barsInView);
//// Default TF of the Chart ( Bottom Ribbon )
HaClose =EMA((O+H+L+C)/4,3);
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
//PlotText("HAS MTF :"+Interval(2), textoffset, 41.01, colorYellow);
Color = IIf( Haopen > Haclose,4, IIf( Haopen == Haclose,colorYellow, 6));
Plot(2,"", Color, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
Plot( 3,"",colorDarkGrey,styleOwnScale|styleArea|styleNoLabel,0, 100 );
//// 3 X TF Plot ( 2nd Ribbon from Bottom )
Compress2= Param("Compression",3,1,3,1);
TimeFrameSet(Compress2* Interval());
HaClose2 =EMA((O+H+L+C)/4,3);
HaOpen2 = AMA( Ref( HaClose2, -1 ), 0.5 );
HaHigh2 = Max( H, Max( HaClose2, HaOpen2 ) );
HaLow2 = Min( L, Min( HaClose2, HaOpen2 ) );
//PlotText("HAS MTF :"+Interval(2), textoffset, 41.055, colorYellow);
TimeFrameRestore();
HAopen2f=TimeFrameExpand( Haopen2, Compress2* Interval());
Haclose2f=TimeFrameExpand( Haclose2, Compress2* Interval());
HaHigh2f=TimeFrameExpand( Hahigh2, Compress2* Interval());
HaLow2f=TimeFrameExpand( Halow2, Compress2* Interval());
Color2 = IIf( Haopen2f > Haclose2f,4, IIf(Haopen2f == Haclose2f,colorYellow, 6));
Plot(5,"", Color2, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
Plot( 6,"",colorDarkGrey,styleOwnScale|styleArea|styleNoLabel,0, 100 );
//// 6 X TF Plot ( 3rd Ribbon from Bottom )
Compress3= Param("Compression3",6,2,6,1);
TimeFrameSet(Compress3* Interval());
HaClose3 =EMA((O+H+L+C)/4,3);
HaOpen3 = AMA( Ref( HaClose3, -1 ), 0.5 );
HaHigh3 = Max( H, Max( HaClose3, HaOpen3 ) );
HaLow3 = Min( L, Min( HaClose3, HaOpen3 ) );
//PlotText("HAS MTF :"+Interval(2), textoffset,41.10, colorYellow);
TimeFrameRestore();
HAopen3f=TimeFrameExpand( Haopen3, Compress3* Interval());
Haclose3f=TimeFrameExpand( Haclose3, Compress3* Interval());
HaHigh3f=TimeFrameExpand( Hahigh3, Compress3* Interval());
HaLow3f=TimeFrameExpand( Halow3, Compress3* Interval());
color3 = IIf( Haopen3f > Haclose3f,4, IIf( Haopen3f == Haclose3f,colorYellow,6));
Plot(8,"", Color3, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
Plot(9,"",colorDarkGrey,styleOwnScale|styleArea|styleNoLabel,0, 100 );
//// 12 X TF Plot ( 4th Ribbon from Bottom )
Compress4= Param("Compression4",12,2,12,1);
TimeFrameSet(Compress4* Interval());
HaClose4 =EMA((O+H+L+C)/4,3);
HaOpen4 = AMA( Ref( HaClose4, -1 ), 0.5 );
HaHigh4 = Max( H, Max( HaClose4, HaOpen4 ) );
HaLow4 = Min( L, Min( HaClose4, HaOpen4 ) );
//PlotText("HAS MTF :"+Interval(2), textoffset, 41.14, colorYellow);
TimeFrameRestore();
HAopen4f=TimeFrameExpand( Haopen4, Compress4* Interval());
Haclose4f=TimeFrameExpand( Haclose4, Compress4* Interval());
HaHigh4f=TimeFrameExpand( Hahigh4, Compress4* Interval());
HaLow4f=TimeFrameExpand( Halow4, Compress4* Interval());
Color4 = IIf( Haopen4f > Haclose4f,4, IIf( Haopen4f == Haclose4f ,colorYellow, 6));
Plot(11,"", Color4, styleHistogram+styleThick|styleOwnScale|styleNoLabel, 0, 100 );
Plot( 12,"",colorDarkGrey,styleOwnScale|styleArea|styleNoLabel,0, 100 );
_SECTION_END();
There is a substantial risk of loss associated with trading in Stock Markets. Losses can and will occur. No responsibility for loss occurred to any person acting or refraining to act as a result of using the AFL written by their respective creators and published in this Blog for sharing of knowledge can be accepted by the Blog owner.EDUCATIONAL PURPOSE ONLY. IF u have a problem then u create anything we will follow you before complaint anything entire blog contents.
Brother this is not working for me, so what can I do. can u give me a the original formula.
ReplyDeleteplease send me: shoncorner@yahoo.com