dnbar=C<Ref(C,-1);
Vh=V>Ref(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;
dcls=x1>2;
mcls=x1<2.2 AND x1>1.8 ;
Vlcls=x1>4;
Vhcls=x1<1.35;
j=MA(C,5);
TLL=LinRegSlope(j,40) ;
Tlm=LinRegSlope(j,15) ;
tls=LinRegSlope(j,5);
mp=(H+L)/2;
_SECTION_END();
//================================================
==========================================
_SECTION_BEGIN("VSA");
utbar=wrb AND dcls AND tls>0 ;
utcond1=Ref(utbar,-1) AND dnbar ;
utcond2=Ref(utbar,-1) AND dnbar AND V>Ref(V,-1);
utcond3=utbar AND V> 2*Vrg;
trbar=Ref(V,-1)>Vrg AND Ref(upbar,-1) AND Ref(wrb,-1) AND dnbar AND dcls
AND wrb AND tll>0 AND H==HHV(H,10);
Hutbar=Ref(upbar,-1) AND Ref(V,-1)>1.5*Vrg AND dnbar AND dcls AND NOT wrb
AND NOT utbar;
Hutcond=Ref(Hutbar,-1) AND dnbar AND dcls AND NOT utbar;
//================================================
================================================
=======================
_SECTION_BEGIN("Chart");
Vcolor=IIf(tls>0 AND tlm>0 AND tll>0,colorLime,IIf(tls>0 AND tlm>0 AND
tll<0,colorGreen,
IIf(tls>0 AND tlm<0 AND tll<0,colorPaleGreen,IIf(tls<0 AND tlm<0 AND
tll<0,colorRed,IIf(tls<0 AND tlm>0 AND tll>0,colorPaleGreen,
IIf(tls<0 AND tlm<0 AND tll>0,colorOrange,colorBlue))))));
GraphXSpace = 5;
Vpc= utbar OR utcond1 OR utcond2 OR utcond3 OR stdn0 OR stdn1 OR stdn2 OR
stdn OR lvtbar1 OR Lvtbar OR Lvtbar2 OR Hutbar OR Hutcond OR ndbar OR stvol
OR tcbar;
//PlotOHLC( Open, High, Low, Close, "", vcolor, styleCandle | styleThick );
_SECTION_END();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("MACD Fill");
// Parameters
PeriodEMA = 13;
MACDIndicatorRange = 50;
// Volume filter
VolumeFilter = Param( "Volume MA filter", 100000, 50000, 500000, 100000 );
Timeframe = Interval(2);
// Adjust for weekly if necessary
if( Timeframe == "5-day" || Timeframe == "Weekly" ) {
VolumeFilter = VolumeFilter * 5;
}
else if( Timeframe == "Monthly") {
VolumeFilter = VolumeFilter * 20;
}
else if( Timeframe != "Daily" ) {
VolumeFilter = 0;
}
// Minimum number of bars required to form a divergence pattern. For a
// positive divergence, this is the number of falling bars in the context
// of a rising MACD or MACD-H pattern. Vice versa for negative divergence
MACDDivMinWidth = Param("Divergence min width", 4, 1, 10, 1 );
// Minimum width of negative projecting wave between two positive MACD-H
waves,
// otherwise two positive waves will be considered as one single wave. This
// minimises invalid divergences, to ensure that "back of bears is broken".
// The same applies for a positive wave between two negative waves.
HistMinWidth = Param("Histogram min width", 4, 1, 10, 1 );
PeriodEMA = Optimize( "PeriodEMA ", 13, 5, 23, 1 );
// Other parameters
OpenPositions = 10;
ATRPeriod = 5;
InitialCapital = 100000;
PeriodFast = Param( "Fast EMA", 8, 2, 200, 1 );
PeriodSlow = Param( "Slow EMA", 17, 2, 200, 1 );
PeriodSignal = Param( "Signal EMA", 9, 2, 200, 1 );
MACDInd = MACD(PeriodFast, PeriodSlow );
SigInd = Signal(PeriodFast, PeriodSlow , PeriodSignal );
HistInd = MACDInd - SigInd ;
_N( macdStr = WriteVal( PeriodFast, 1.0 )+","+WriteVal( PeriodSlow , 1.0 ) );
_N( sigStr = macdStr + ","+WriteVal( PeriodSignal , 1.0 ) );
// Get displayed min and max value of MACD and MACD-H, to rescale it for better
visibility
scMACDMax = LastValue(HHV(Max(MACDInd, sigInd),
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),1) )));
scMACDMin = LastValue(LLV(Min(MACDInd, sigInd),
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),1) )));
scaleMACD = Max( abs(scMACDMax), abs(scMACDMin) );
scHistMax = LastValue(HHV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scHistMin = LastValue(LLV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scaleHist = Max( abs(scHistMax), abs(scHistMin) );
_SECTION_END();
//////////////////////////////////////////////////////////////////////////////////////////////////////////MACD Fill
///MACD
Fill////////End///////////////////////////////////////////////////////////////////////////////////MACD Fill
//////////////////////////////////////////////////////////////////////////////////////////////////////////MACD Fill
_SECTION_BEGIN("Matrix
Swing");//===========================================
================================================
============\\
UpBarColor = ParamColor( "UpBar Color", colorGreen );
DownBarColor = ParamColor( "DownBar Color", colorRed );
MatixSwingSmoother= Param("Smoother", 20, 1, 100, 1);
MatrixBuy = ParamColor( "Buy Color", colorGreen );
MatrixSell = ParamColor( "Sell Color", colorRed );
n=20;
Var1=HHV(High,9)-LLV(Low,9);
Var2=HHV(High,9)-Close;
Var3=Close-LLV(Low,9);
Var4=Var2/Var1*100-70;
Var5=(Close-LLV(Low,60))/(HHV(High,60)-LLV(Low,60))*100;
Var6=(2*Close+High+Low)/4;
Var7=WMA(Var3/Var1*100,3);
Var8=LLV(Low,34);
Var9=WMA(Var7,3)-WMA(Var4,9);
VarA=IIf(Var9>100,Var9-100,0);
VarB=HHV(High,34);
AA= VarA*2;
BB= EMA((Var6-Var8)/(VarB-Var8)*100,13);
VarC=EMA(0.667*Ref(BB,-1)+0.333*BB,2);
VAR1a=(HHV(High,9)-Close)/(HHV(High,9)-LLV(Low,9))*100-70;
VAR2a=WMA(VAR1a,9)+100;
VAR3a=(Close-LLV(Low,9))/(HHV(High,9)-LLV(Low,9))*100;
VAR4a=WMA(VAR3a,3);
VAR5a=WMA(VAR4a,3)+100;
VAR6a=VAR5a-VAR2a;
S= IIf(VAR6a>n,VAR6a-n,Var6a);
barcolor=IIf(Ref(S,-1)<S, upbarcolor, downbarcolor);
Oo=IIf(Ref(S,-1)<s,Ref(s,-1),s);
Hh=Oo;
Ll=IIf(Ref(S,-1)>s,Ref(s,-1),s);
Cc=Ll;
MatrixBB = (Close - BBandBot (Close, MatixSwingSmoother, 2))
/ ((BBandTop (Close, MatixSwingSmoother, 2) - BBandBot (Close,
MatixSwingSmoother, 2)));
//PlotOHLC( Oo,hh,ll,Cc, "Matrix Swing", barcolor, styleCandle|styleNoLabel );
MBuy=Cross(MatrixBB,0);
MSell=Cross(1, MatrixBB);
//PlotShapes (IIf(MBuy, shapeCircle, shapeNone) ,MatrixBuy, layer = 0, yposition
=Oo, offset = 1 );
//PlotShapes (IIf(MSell, shapeCircle, shapeNone) ,Matrixsell, layer = 0, yposition
= Ll, offset = 1 );
_SECTION_END();//=====================================
================================================
==================================\\
///////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////Candle DES////////////////////////////////////////
////////////////////////////////////////Starts//////////////////////////////////////////
_SECTION_BEGIN("hai");
/*ndele
Copiare questo dile nell'area commenti "Formula" del "Guru Commentary" di
Amibroker.
Le frecce Verdi piene indicano candele Bullish "rialziste" con elevata affidabilit.
Le frecce Verdi vuote indicano candele Bullish "rialziste" con moderata e bassa
affidabilit.
Le frecce Rosse piene indicano candele Bearish "ribassiste" con elevata
affidabilit.
Le frecce Rosse vuote indicano candele Bearish "ribassiste" con moderata e
bassa affidabilit.
Spostare il cursore e cliccare sulla candela prescelta per avere il commento.
I commenti sono di Steve Nison "Japanese Candlestick Charting Techniques" e dal
sito LitWick.
**********************************************************/
/*Colori candele*/
whiteBody=C>=O;
blackBody=O>C;
/*Ampiezza candele*/
smallBodyMaximum=0.0025;//meno di 0.25%
LargeBodyMinimum=0.01;//meno di 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*/
/*Definizione candele*/
spinningTop=mediumBody;
doji=CdDoji(threshold=0.05);/*abs(C-O) <= (C*smallBodyMaximum) OR
(abs(O-C)<=((H-L)*0.1));*/
dojiStar=doji AND (upgap OR downgap)AND Ref(LargeBody,-1);
marabuzu=LargeBody AND smallUpperShadow AND smallLowerShadow;
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 C<Ref(C,-1) AND O>Ref(O,-1),1,
IIf(blackBody AND Ref(whiteBody,-1) AND O>Ref(C,-1) AND C<Ref(O,-1),1,
IIf(whitebody AND Ref(whitebody,-1) AND C>Ref(C,-1) AND O<Ref(O,-1),1,
IIf(whiteBody AND Ref(blackBody,-1) AND C>Ref(O,-1)AND O<Ref(C,-1),1,0))));
Harami=
IIf(blackbody AND Ref(blackBody,-1) AND O<Ref(O,-1) AND C>Ref(C,-1),1,
IIf(blackBody AND Ref(whiteBody,-1) AND C>Ref(O,-1) AND O<Ref(C,-1),1,
IIf(whiteBody AND Ref(whiteBody,-1) AND C<Ref(C,-1) AND O>Ref(O,-1),1,
IIf(whiteBody AND Ref(blackBody,-1) AND O>Ref(C,-1) AND C<Ref(O,-1),1,0))));
/*Definizioni DOJI */
/**************************************************
CANDELE BULLISH
*************************************************** */
/*BreakAway Bullish*/
breakAwayBullish=Ref(Largebody,-4) AND Ref(blackBody,-4)
AND Ref(blackBody,-3) AND Ref(O,-3)<Ref(C,-4)
AND Ref(smallbody,-2) AND Ref(C,-2)<Ref(C,-3)
AND Ref(C,-1)<Ref(C,-2)
AND LargeBody AND whiteBody AND C>Ref(O, -3)
AND C<Ref(C,-4);
/*Engulfing Bullish*/
engulfingBullish =
engulfing AND largeBody AND whiteBody AND
(Ref(blackbody,-1) OR Ref(Doji,-1)) AND MLT;
/*Hammer Bullish*/
hammerBullish=Hammer AND (MLT OR MLY);
/* Harami Bullish*/
/*Harami Cross*/
HaramiCross=harami AND Ref(LargeBody,-1) AND Ref(blackBody,-1) AND doji;
/* Homing Pigeon*/
homingPigeon = Ref(largeBody,-1) AND Ref(blackBody,-1) AND
H<= Ref ( O, -1 ) AND L>=Ref( C, -1) AND C<O AND MLY;
/*Inverted Hammer*/
invertedHammer=shootingStar AND (MLT OR MLY);
/* Meeting LinesBullish*/
meetingLinesbullish= Ref(LargeBody,-1) AND Ref(blackBody,-1) AND
LargeBody AND whiteBody AND
C>Ref(C,-1)*0.9975 AND C< Ref(C,-1)*1.0025;
/* 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(L,-1) AND C>=(Ref(O,-1)+Ref(C,-1))/2 AND C<Ref(O,-1) AND
MLT;
/* Stick Sandwich*/
stickSandwich=Ref(largeBody,-2) AND Ref(blackbody,-2) AND
Ref(largeBody,-1) AND Ref(whiteBody,-1) AND
Ref(O,-1)>=Ref(C,-2) AND O>=Ref(C,-1) AND
abs(C-Ref(C,-2))<=C*0.0025;
/* Tri-Star Bullish*/
triStarBullish=Ref(doji,-2) AND Ref(doji,-1) AND doji AND MLY AND
/*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) AND Ref(C,-2)<Ref(C,-3) AND Ref(C,-1)<Ref(C,-2) AND
LargeBody AND whitebody AND C>Ref(C,-4);
/*Tweezer Bottom*/
tweezerBottom= (abs(L-Ref(L,-1))/L<0.0025 OR
abs(L-Ref(L,-2))/L<0.0025)
AND (MLT OR MLY);
/*****************************************
CANDELE BEARISH
******************************************/
/*Breakaway Bearish*/
breakAwayBearish=Ref(LargeBody,-4) AND Ref(whiteBody,-4) AND
Ref(GapUp(),-3) AND Ref(whiteBody,-3) AND
Ref(smallbody,-2) AND Ref(smallBody,-1) AND
blackBody AND O>Ref(O,-3) AND C<Ref(C,-4);
/*CounterAttackBearish*/
CounterAttackBearish=MHT AND LargeBody AND blackbody AND
Ref(largeBody,-1) AND Ref(whiteBody,-1) AND
C<Ref(C,-1)*1.0025 AND C>Ref(C,-1)*0.9975;;
/*Engulfing Bearish*/
engulfingBearish=engulfing AND largeBody AND blackBody AND
/*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;
/*Harami Bearish-*/
HaramiBearish=harami AND Ref(Largebody,-1) AND Ref(whiteBody,-1)AND
blackBody
AND (MHY OR MHT);
/*HaramiCross Bearish*/
/*ShootingStar*/
shootingStarGap=shootingStar AND GapUp() AND MHT;
/*Gravestone Doji*/
gravestoneDoji=doji AND largeUpperShadow AND smallLowerShadow AND
GapUp()AND MHT;
/*Thrusting Bearish*/
thrustingBearish=Ref(blackBody,-1) AND Ref(LargeBody,-1) AND LargeBody AND
whitebody AND O<Ref(L,-1) AND C<(Ref(O,-1)+Ref(C,-1))/2 AND C>Ref(C,-1);
/*Tweezer Top*/
tweezerTop= (abs(H-Ref(H,-1))/H<0.0025 OR
abs(H-Ref(H,-2))/H<0.0025)
AND (MHT OR MHY);
/* ***********************************************
Regole di Buy (Alta Affidabilit)
**************************************************
Buy=
abandonedBabybullish OR
ConcealingBabySwallow OR
morningDojiStar OR
morningStar OR
threeInsideUp OR
threeOutsideUp OR
MAtHoldBullish OR
risingThreeMethods OR
sideBySideWhiteLines OR
threeWhiteSoldiers;
/* ***********************************************
Regole di Cover (Moderata e Bassa Affidabilit)
**************************************************
Cover=
beltHoldBullish OR
breakAwayBullish OR
dojiStarBullish OR
engulfingBullish OR
hammerBullish OR
dragonflyDoji OR
haramiBullish OR
HaramiCross OR
homingPigeon OR
invertedHammer OR
meetingLinesbullish OR
piercingLine OR
stickSandwich OR
threeStarsInTheSouth OR
triStarBullish OR
threeriverBottom OR
separatingLinesBullish OR
upsideGapThreeMethods OR
threeLineStrike OR
tweezerBottom OR
upsideTasukiGap;
/************************************
Regole di Short (bassa e media affidabilit)
*************************************
Short=
advanceBlockBearish OR
beltHoldBearish OR
breakAwayBearish OR
HangingMan OR
deliberationBearish OR
CounterAttackBearish OR
engulfingBearish OR
HammerBearish OR
dragonflyDojiBearish OR
HaramiBearish OR
HaramiCrossBearish OR
MeetingLinesBearish OR
shootingStarGap OR
gravestoneDoji OR
triStarBearish OR
twoCrows OR
dojiStarBearish OR
downsideGapThreeMethods OR
downsideTasukiGap OR
inNeckBearish OR
OnNeckBearish OR
separatingLinesBearish OR
sideBySideWhiteLinesBearish OR
threeLineStrike OR
thrustingBearish OR
tweezerTop;
/************************************
Regole di Sell (alta affidabilit)
*************************************
Sell=
AbandonedBabyBearish OR
darkCloudCover OR
eveningDojiStar OR
eveningStar OR
idendicalThreeBlackCrows OR
kickingBearish OR
threeInsideDownBearish OR
threeoutsideDownBearish OR
upsideGapTwoCrows OR
fallingThreeMethods OR
threeBlackCrows;
*/
_SECTION_END();
///////////////////////////////////////////Candle Des///////////////////////////////////
///////////////////////////////////////////////End////////////////////////////////////////////////////////////////////
// Trend Detection
// Graham Kavanagh 11 Jan 05
// I am using version 4.66.2, but believe this will work with last offical Version.
for(i=1;i<BarCount;i++)
{
if( CondR[i] )
{
R[i] = 1;
}
else
{
if( CondF[i] )
{
R[i] = 0;
}
else
{
R[i] = R[i-1];
}
}
}
return R;
}
PrD = C;
PrL = H/2+L/2;
PrdD = PrdL = PrdM = Param("Prd",12,2,40,1);
permax = Max(prdd,prdl);
Confirm = MA(C,prdm);
for(i=1;i<BarCount;i++)
{
if( dr[i-1] && df[i] )
{
B[i] = 1;
}
else
{
if( df[i-1] && dr[i] )
{
B[i] = 1;
}
else
{
B[i] = B[i-1] + 1;
}
}
}
return B;
}
Bs = DirBar( Rs, Fs );
//Plot( C, "close", IIf( Rs, colorGreen, IIf( Fs, colorRed, colorBlack )), styleBar);
//GraphXSpace=10;
//_N( Title = "{{NAME}} - {{INTERVAL}} {{DATE}} Trend Plot - "+prdd+" Day" );
}
*/
// outs comments
"BarIndex = " + BarIndex();
"Open = " + Open;
"High = " + High;
"Low = " + Low;
"Close = "+ Close;
"HaOpen = " + HaOpen;
"HaHigh = " + HaHigh;
"HaLow = " + HaLow;
"HaClose = "+ HaClose;
PlotShapes( shapeHollowSmallCircle* select, colorBrightGreen, 0, HaLow, -21 );
PlotShapes( shapeHollowSmallCircle* Caution, colorRed, 0, HaHigh,21 );
pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
BrightGreen=HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
BrightRed=LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);
//SetBarFillColor( );
SetBarFillColor(IIf(Mbuy,colorBlue,IIf(MSell, colorYellow,IIf(MACDInd >SigInd,
MACDColorUp,MACDColorDown))));
//////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Pivot");
nBars = Param("Number of bars", 12, 5, 40);
bShowTCZ = Param("Show TCZ", 1, 0, 1);
nExploreBarIdx = 0;
nExploreDate = 0;
nCurDateNum = 0;
DN = DateNum();
DT = DateTime();
bTCZLong = False;
bTCZShort = False;
nAnchorPivIdx = 0;
ADX8 = ADX(8);
if(Status("action")==1) {
bDraw = True;
bUseLastVis = 1;
} else {
bDraw = False;
bUseLastVis = False;
bTrace = 1;
nExploreDate = Status("rangetodate");
for (i=LastValue(BarIndex());i>=0;i--) {
nCurDateNum = DN[i];
if (nCurDateNum == nExploreDate) {
nExploreBarIdx = i;
}
}
}
GraphXSpace=7;
if (bDraw) {
}
aHPivs = H - H;
aLPivs = L - L;
aHPivHighs = H - H;
aLPivLows = L - L;
aHPivIdxs = H - H;
aLPivIdxs = L - L;
aAddedHPivs = H - H;
aAddedLPivs = L - L;
aLegVol = H - H;
aRetrcVol = H - H;
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);
nLastVisBar = LastValue(
Highest(IIf(Status("barvisible"), BarIndex(), 0)));
curBar = IIf(nlastVisBar > 0 AND bUseLastVis, nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0, nExploreBarIdx,
LastValue(BarIndex())));
curTrend = "";
if (aLLVBars[curBar] < aHHVBars[curBar])
curTrend = "D";
else
curTrend = "U";
if (curBar >= 120) {
for (i=0; i<120; i++) {
curBar = IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar-i,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx-i,
LastValue(BarIndex())-i));
if (aLLVBars[curBar] < aHHVBars[curBar]) {
if (curTrend == "U") {
curTrend = "D";
curPivBarIdx = curBar - aLLVBars[curBar];
aLPivs[curPivBarIdx] = 1;
aLPivLows[nLPivs] = L[curPivBarIdx];
aLPivIdxs[nLPivs] = curPivBarIdx;
nLPivs++;
}
} else {
if (curTrend == "D") {
curTrend = "U";
curPivBarIdx = curBar - aHHVBars[curBar];
aHPivs[curPivBarIdx] = 1;
aHPivHighs[nHPivs] = H[curPivBarIdx];
aHPivIdxs[nHPivs] = curPivBarIdx;
nHPivs++;
}
}
}
}
curBar =
IIf(nlastVisBar > 0 AND bUseLastVis,
nlastVisBar,
IIf(Status("action")==4 AND nExploreBarIdx > 0,
nExploreBarIdx,
LastValue(BarIndex()))
);
if (nHPivs >= 2 AND nLPivs >= 2) {
lastLPIdx = aLPivIdxs[0];
lastLPL = aLPivLows[0];
lastHPIdx = aHPivIdxs[0];
lastHPH = aHPivHighs[0];
/*
){
aLPivs[nLLVIdxAfterLastPiv] = 1;
aAddedLPivs[nLLVIdxAfterLastPiv] = 1;
//
//
//
} else {
){
aLPivs[nLLVIdxAfterLastPiv] = 1;
aAddedLPivs[nLLVIdxAfterLastPiv] = 1;
//
//
}
// -- The last piv is a high and we have higher highs
//
OR lower highs
/* ****************************************************************
Still finding missed pivot(s). Here, the last piv is a low piv.
**************************************************************** */
} else {
){
aHPivs[nHHVIdxAfterLastPiv] = 1;
aAddedHPivs[nHHVIdxAfterLastPiv] = 1;
//
//
//
} else {
){
aHPivs[nHHVIdxAfterLastPiv] = 1;
aAddedHPivs[nHHVIdxAfterLastPiv] = 1;
//
//
/* ****************************************
// -- Done with finding pivots
***************************************** */
if (bDraw) {
PivotEntry = ParamColor( "Entry Color", colorBrightGreen );
PivotEntry2 = ParamColor( "Entry Color2", colorYellow );
PivotExit = ParamColor( "Exit Color", colorRed );
PivotExit2 = ParamColor( "Exit Color2", colorYellow );
// -- OK, let's plot the pivots using arrows
PlotShapes(
IIf(aHPivs==1, shapeSquare, shapeNone),
PivotExit, 0, High, Offset=30);
PlotShapes(
IIf(aAddedHPivs==1, shapeSquare, shapeNone),
PivotExit2, 0, High, Offset=30);
PlotShapes(
IIf(aLPivs==1, shapeSquare , shapeNone),
PivotEntry, 0, Low, Offset=-30);
PlotShapes(
PlotShapes(
IIf(aHPivs==1, shapeSquare, shapeNone),
colorBlack, 0,
High, Offset=35);
PlotShapes(
IIf(aAddedHPivs==1, shapeSquare, shapeNone),
colorBlack, 0, High, Offset=35);
PlotShapes(
IIf(aLPivs==1, shapeSquare , shapeNone),
colorBlack, 0, Low, Offset=-35);
PlotShapes(
IIf(aAddedLPivs==1, shapeSquare , shapeNone),
colorBlack, 0, Low, Offset=-35);
PlotShapes(
IIf(aAddedHPivs==1, shapeSmallCircle, shapeNone),
PivotExit2, 0, High, Offset=30);
PlotShapes(
IIf(aAddedLPivs==1, shapeSmallCircle , shapeNone),
colorYellow, 0, Low, Offset=-30);
/* ****************************************
// -- Done with discovering and plotting pivots
***************************************** */
_SECTION_END();
_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), colorWhite,
styleThick );
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), colorWhite,
styleThick );
_SECTION_END();
//////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Peak");
Plot(SD, "LastMinorResistance",colorDarkGrey,styleLine);
_SECTION_BEGIN("Support");
SP = Ref(HaLow,1) > HaLow AND HaLow < Ref(HaLow,-1);//Peak
SPV0 = ValueWhen(SP,HaLow,0);//PeakValue0
SPV1 = ValueWhen(SP,HaLow,1);//PeakValue1
SPV2 = ValueWhen(SP,HaLow,2);//PeakValue2
MSP = SPV2 > SPV1 AND SPV1 < SPV0 ;//MajorPeak
MSPV = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, SPV1,1);
MSPD = ValueWhen(Ref(MSP,-1) == 0 AND MSP == 1, DateNum(),1);
SD = IIf(DateNum() < LastValue(MSPD,lastmode = True ), Null,
LastValue(MSPV,Lastmode = True));
Plot(SD,"LastMinorSupport",colorDarkGrey,styleLine);
_SECTION_END();
_N(Title = StrFormat("\\c02**www.stockbangladesh.com**...{{NAME}} |
{{DATE}} | {{VALUES}}",O, H, L, C, SelectedValue( ROC( C, 1 )) )
+"\n"+EncodeColor(colorOrange) +"Open
+
= " + EncodeColor(colorWhite) + O
"\n"+EncodeColor(colorOrange) +"High
= " + EncodeColor(5) + H +
"\n"+EncodeColor(colorOrange) +"Low
= " + EncodeColor(colorRed) + L
+"\n"+WriteIf( Ref(C,-1)<C ,
EncodeColor(colorGreen)+"Close
="
+" "+C
+" "+"(Change%)"
+" "+ pricechange+"%"
+" "+"(Taka)"
+" "+changeponit,
EncodeColor(colorRed)+"Close
="
+" "+C
+" "+"(Change%)"
+" "+pricechange+"%"
+" "+"(Taka)"
+" "+changeponit)
+EncodeColor(colorBlack)+"."
+EncodeColor(colorBrightGreen) +WriteVal( V, 1.0 )
+(" : ")+WriteIf(V>Vp2,EncodeColor(colorLime)+"Very
High",WriteIf(V>Vp1,EncodeColor(colorLime)+"
High",WriteIf(V>Vrg,EncodeColor(colorLime)+"Above Average",
WriteIf(V<Vrg AND V>Vn1,EncodeColor(colorRed)+"Less than
Average",WriteIf(V<Vn1,"Low","")))))
+"\n"
+"\n"
+WriteIf(Vpc,"COMMENTARY:\n","")
+EncodeColor(colorRed)+WriteIf(utbar , "Up-thrusts are designed to catch stops
and to mislead as many traders as possible.\nThey are normally seen after there
has been weakness \nin the background. The market makers know that the
\nmarket is weak, so the price is marked up to catch stops\n, encourage traders
to go long in a weak market, \nAND panic traders that are already Short into
covering \ntheir very good position.","")
+EncodeColor(colorRed)+WriteIf(utcond3,"This upthrust bar is at high
volume.\nThis is a sure sign of weakness. \nOne may even seriously consider
ending the Longs \nAND be ready to reverse","")
+EncodeColor(colorRed)+WriteIf(utbar OR utcond3," Also note that A wide
spread \ndown-bar that appears immediately after any up-thrust, \ntends to
confirm the weakness (the market makers \nare locking in traders into \npoor
positions).With the appearance of an upthrust \nyou should certainly be paying
attention to your trade \nAND your stops. On many upthrusts you will \nfind that
the market will 'test' almost immediately.","")
+EncodeColor(colorRed)+WriteIf(utcond1 , "A wide spread down bar following a
Upthrust Bar.\n This confirms weakness. The Smart Money is locking in Traders
into poor positions","")
+EncodeColor(colorRed)+WriteIf(utcond2 , "Also here the volume is high( Above
Average).\nThis is a sure sign of weakness. \nThe Smart Money is locking in
Traders into \npoor positions","")
+EncodeColor(colorBrightGreen)+WriteIf(stdn, "Strength Bar. The stock has been
in a down Trend. \nAn upbar with higher Volume closing near the High \nis a sign
of strength returning. \nThe downtrend is likely to reverse soon. ","")
+EncodeColor(colorBrightGreen)+WriteIf(stdn1,"Here the volume is very much
above average. \nThis makes this indication more stronger. ","")
+EncodeColor(colorBrightGreen)+WriteIf(bycond,"The previous bar saw strength
coming back. \nThis upbar confirms strength. ","")
+"\n"
+"\n"
+"\n"
+"\n"+/**************************************************
Standards of Cover (Moderate and low Reliability)
/***************************************************/
EncodeColor(colorBrightGreen)+
WriteIf(beltHoldBullish,"(+) Belt Hold Bullish. Pattern reversal.\nThe wider the
candle, the more significant.\nReliability second LitWick: Low. \n","") +
WriteIf(breakAwayBullish,"(+) breakvar Away Bullish. Pattern reversal.\nReliability
second LitWick: Moderate \n","") +
WriteIf(dojiStarBullish,"(+) Bullish doji Star. Pattern reversal.\nNison: Requires
confirmation. Best sign on top.\nReliability second LitWick: Moderate \n","") +
WriteIf(hammerBullish,"(+) Bullish Hammer. Pattern reversal.\nNison: The longer
the tail lower (shadow), is shorter than the upper tail AND smaller the body of
the candle, the more significant the pattern. The candles are white rialziste more
than the black body with candles. \\ NReliability Second LitWick: Low. \n","") +
WriteIf(dragonflyDoji,"(+) Dragonfly Doji. Reliability second LitWick: Moderate
\n","") +
/**************************************
Commenti
***************************************
Candles bullish - Bullish
****************************************/
EncodeColor(colorGreen)+
WriteIf(abandonedBabybullish,"(+) Abandoned Baby Bullish. Pattern
reversal.\nReliability second LitWick: high. \n","") +
WriteIf(ConcealingBabySwallow,"(+) Concealing Baby Swallow. Pattern
reversal.\nReliability second LitWick: high. \n","") +
WriteIf(engulfingBullish,"(+) Bullish Engulfing. Pattern reversal.\nNison: The
factors that increase the effect of the pattern are\n 1) The first day (before) the
candle has a small body on the second day and has a wide body.\n 2) The pattern
appears after a move very fast or very protracted. \n 3) High Volume on the
second day (current).\n 4)The days seconfo covers (Engulfs) more of a candle.\n
Reliability second LitWick: Moderate \n","") +
WriteIf(morningDojiStar,"(+) Morning Doji Star. Pattern reversal.\nImportant sign
of reversal.\nReliability second LitWick: high. \n","") +
WriteIf(morningStar,"(+) Morning Star. Pattern reversal.\nNison: Better
according to increase the size of the white candle (third).\nReliability Second
LitWick: high. \n","") +
WriteIf(threeInsideUp,"(+) 3 Inside Up. Pattern reversal.\nReliability second
LitWick: high. \n","") +
WriteIf(threeOutsideUp,"(+) 3 Outside Up. Pattern reversal.\nReliability second
LitWick: High. \n","") +
WriteIf(MAtHoldBullish,"(+) Mat Hold Bullish. Pattern continued.\nNison: 2-4 may
have black candles.\nReliability Second LitWick: High. \n","") +
WriteIf(risingThreeMethods,"(+) Rising Three Methods. Pattern
continued.>\nNison: Ha maggior significato se il volume delle candele bianche
maggiore rispetto a quello delle candele nere.\nReliability second LitWick:
High. \n","") +
WriteIf(sideBySideWhiteLines,"(+) Side by Side White Lines. Pattern
continued.\nNison: if in a downtrend may be caused by ricoperture be
Short.\nReliability Second LitWick: High. \n","") +
**************************************************/
EncodeColor(colorPink)+
WriteIf(beltHoldBearish,"(-) Belt Hold Bearish. Pattern reversal.\nNison: The
longer the height of the candle is the most significant pattern.\nReliability second
LitWick: Low. \n","") +
WriteIf(breakAwayBearish,"(-) breakvar Away Bearish. Pattern
reversal.\nReliability second LitWick: Moderate \n","") +
WriteIf(HangingMan,"(-) Hanging Man. Pattern reversal.\nNison: Such a 'bearish
hammer' with a significant gap down the next day. \nReliability second LitWick:
Low. \n","") +
WriteIf(deliberationBearish,"(-) Deliberation Bearish. Pattern reversal.\nNison: It is
not a real pattern of reversal, but a sign that the rally is weakening. \n Reliability
second LitWick: Moderate \n","") +
WriteIf(CounterAttackBearish,"(-) Counter Attack Bearish.\nNison: un potenziale
stallo del rally. \n","") +
WriteIf(engulfingBearish,"(-) Engulfing Bearish. Pattern reversal.\nNison:
Important sign of reversal. The factors that increase the importance of the
patterns are: \n 1) above the candle has a very small body AND the Second
candle is a very large body. \n 2) the pattern appears after a protracted OR
moving very fast. \n 3 ) High volumes in the Second Day. \n 4) on the Second Day
covers the body more than a body of candles before.\nReliability Second LitWick:
Moderate \n","") +
WriteIf(HaramiCrossBearish,"(-) Harami Cross Bearish. Pattern reversal.\nNison:
more significant downtrend pattern of 'Harami'. The second day, the candle can
be white or black.\nReliability second LitWick: Moderate \n","") +
WriteIf(MeetingLinesBearish,"(-) Meeting Lines Bearish. Pattern
reversal.\nReliability second LitWick: moderate, but not so strong as' Dark Cloud
Cover '. \n","") +
WriteIf(shootingStarGap,"(-) Shooting Star. Pattern reversal.\nNison: not so
important as an 'evening star'. Ideally, the body of the candle should be in a gap
from the body of the candle before. It should appear after a positive
trend.\nReliability second LitWick: Low. \n","") +
WriteIf(gravestoneDoji,"(-) Gravestone Doji. Pattern reversal.\nNison: more
significant when touching a new all-time high.\nReliability second LitWick:
Moderate \n","") +
WriteIf(triStarBearish,"(-) Tri-Star Bearish. Pattern reversal.\nNison: pattern of
very significant reversal.\nReliability second LitWick: Moderate \n","") +
WriteIf(twoCrows,"(-) 2 Crows. Pattern reversal.\nReliability second LitWick:
Moderate \n","") +
WriteIf(dojiStarBearish,"(-) Doji Star Bearish. Pattern reversal.\nNison: Requires
confirmation.\nReliability second LitWick: Moderate \n","") +
WriteIf(downsideGapThreeMethods,"(-) Downside Gap 3 Methods. Pattern
continued.\nReliability second LitWick: Moderate \n","") +
WriteIf(downsideTasukiGap,"(-) Downside Tasuki Gap. Method of
continuation.\nNison: if the last Day we closed the gap, the pattern to
continuevar is denied.\nReliability Second LitWick: Moderate \n","") +
WriteIf(inNeckBearish,"(-) In Neck Bearish. Pattern continued.\nNison: as in
'piercing pattern' but more bearish on the second day because there is no
penetration.\nReliability second LitWick: Moderate \n","") +
WriteIf(OnNeckBearish,"(-) On Neck Bearish. Pattern continued. Similar to
'piercing'ma more bearish because there is no penetration on the second
day.\nReliability second LitWick: Moderate \n","") +
WriteIf(separatingLinesBearish,"(-) Separating Lines Bearish. \n","") +
WriteIf(sideBySideWhiteLinesBearish,"(-) Side by Side White Lines Bearish.
Pattern continued.\nNison: very rare.\nReliability Second LitWick: Moderate
\n","") +
WriteIf(threeLineStrike,"(-) 3 Line Strike. Pattern continued.\nReliability second
LitWick: Low. \n","") +
+"\n"
+"\n"
+"\n"
+"\n"
)
;
///////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("WMA1");
P = ParamField("Price field",-1);
//Periods = Param("Periods",8, 2, 300, 1, 10 );
Plot( WMA( P, 8 ), "WMA(8)", colorOrange, ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("WMA3");
P = ParamField("Price field",-1);
//Periods = Param("Periods", 12, 2, 300, 1, 10 );
Plot( WMA( P, 12 ), "WMA(12)", colorGreen, ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("WMA4");
P = ParamField("Price field",-1);
_SECTION_BEGIN("WMA");
P = ParamField("Price field",-1);
//Periods = Param("Periods", 200, 2, 300, 1, 10 );
Plot( WMA( P, 200), "WMA(200)", colorYellow, 8 );
_SECTION_END();
_SECTION_BEGIN("WMA6");
P = ParamField("Price field",-1);
//Periods = Param("Periods", 50, 2, 300, 1, 10 );
Plot( WMA( P, 50 ), "WMA(50)", colorPink, ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("WMA7");
P = ParamField("Price field",-1);
//Periods = Param("Periods", 100, 2, 300, 1, 10 );
Plot( WMA( P, 100 ), "WMA(100)", ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
_SECTION_END();