com
/*Volume Price Analysis AFL - VPA Version 4.0 -5-05-2016
Revision Details
V-2.0 AFL - fully re written for clarity, Minor bugs removed
V-2.1 support AND resistance line added
V-2.2 Commentary for support AND resistance line breaks Added.
V-2.3 Revision detail- High Volume Lines added
V-2.4 Toggle switch for plotting S/R, High Volume AND Trend lines added
V-2.5 Bar coloring option included - VSA based OR Trend Based
V-3.0 Trend detection Method changed to "Random Walk"
V-3.1 exploration Added
V-3.2 Bug in Exploration fixed
V-4.0 Revamped the formulas for all signals - Especially the No Demand Bar Defn.
Reduced unnecessary signals
Low volume Test signals formula improved
New signal discription for daily signals added like "Move indicates
Strength or weakness".
Effort up or down failure also added
Up and Down Arrows included to indicate change of sentiment.
//===================Version V.4.0.0 ======================
*/
//=========================================================================|
// VPA Basic Module |
//=========================================================================|
_SECTION_BEGIN("VPA Basic Module");
SetChartOptions(0,chartShowArrows|chartShowDates);
gxs=Param("GRAPH spaceing",10,5,50,5);
GraphXSpace = gxs;
SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel
upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
IIf(C<=((spread*0.2)+L),1,IIf(C<=((spread*0.4)+L),2,IIf(C<=((spread*0.6)+L),3,IIf(C
<=((spread*0.8)+L),4,5))));
// 1 = downclose, 2 = belowclose, 3 = MidClose, 4 = aboveClose,
5 = Upclose
Volpos =
IIf(V>volAvg*2,1,IIf(V>volAvg*1.3,2,IIf(V>volAvg,3,IIf(V<volAvg AND
V>volAvg*0.7,4,5))));
//// 1 = Very High, 2 = High, 3 = Above Average, 4 = Less than
Average, 5 = Low
freshGndHi = C > HHV(H,5);
freshGndLo = C < LLV(L,5);
//=========================================================================|
// Trend Analysis Module |
//=========================================================================|
_SECTION_BEGIN("Trend Analysis");
SetChartOptions(0,chartShowArrows|chartShowDates);
minperiodsRWIst = Param ( "Short term Min Periods", 2, 1, 9, 1);
maxperiodsRWIst = Param ( "Short term Max Periods", 8, 1, 9, 1);
_SECTION_END();
//|
===================================================================================
=========|
//| TITLE
|
//|
===================================================================================
=========|
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "Volume Price Analysis V.4.0" + " - " + Name() +
" - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - " +EncodeColor(colorYellow)+
StrFormat("\nOp %g, Hi %g, Lo %g, Cl %g ", O, H, L, C) +
"Volume= "+WriteVal(V)+"--"+EncodeColor(colorYellow)+
switch ( SelectedIndicator )
{
case "VSA Based":
PlotOHLC( Open, High, Low, Close, "", VScolor, styleBar |styleThick );
break;
case "Trend Based":
PlotOHLC( Open, High, Low, Close, "", Trcolor, styleBar |styleThick );
break;
case "Marar Trend Based":
PlotOHLC( Open, High, Low, Close, "", Mcolor, styleBar |styleThick );
//Plot(C,"",Mcolor,styleCandle);
break;
}
_SECTION_END();
//=================================================================================
===|
// Commentry Module
|
//=================================================================================
===|
_SECTION_BEGIN("Commentary");
Vpc= upThrustBartrue OR upThrustCond1 OR upThrustCond2 OR upThrustCond3 OR
strengthDown0 OR strengthDown1 OR strengthDown2 OR
strengthDown OR lowVolTest1 OR pseudoUtCond OR lowVolTest2 OR PseudoUpThrust OR
pseudoUtCond OR noDemandBarUt OR stopVolume OR trendChange OR buyCond OR
noSupplyBar;
printf ( Name() + " - " + Interval(2) + " - " + Date() + " - " + "\n" +
StrFormat("High %g \nLow %g \nOpen %g \nClose %g \nVolume %g ", H, L,
O, C, V));
WriteIf(Vpc,"====================\nVolume Analysis Commentary:","");
//=================================================================================
===================================================================================
========================
_SECTION_BEGIN("Exploration");
Lq=V;
Lqok=Lq>100000;
AddTextColumn(
WriteIf (upThrustBar, "Sign of weakness. ",
WriteIf (upThrustCond1 , "Confirmed weakness. ",
WriteIf (upThrustCond2 AND NOT upThrustCond1 , "Confirms weakness.",
WriteIf (upThrustCond3 , "Confirms weakness",
WriteIf (strengthDown1, "strength returning. ",
WriteIf (strengthDown0 AND NOT strengthDown, "strength returning. ",
WriteIf (strengthDown AND NOT strengthDown1, "strength returning. ",
WriteIf (lowVolTest , "Test for supply. ",
WriteIf (lowVolTest2 , "confirms strength. ",
WriteIf (buyCond, "Change of sentiment to Positive ",
WriteIf (Sellcond, "Change of sentiment to Negative ",
WriteIf (PseudoUpThrust, "Sign of Weakness. ",
WriteIf (topRevBar, "Top Reversal. Sign of Weakness. ",
WriteIf (pseudoUtCond, "Confirms weakness. ",
WriteIf (lowVolTest1, "Sign of Strength. ",
WriteIf (strengthDown2, "Indicates strength. ",
WriteIf (noSupplyBar, "Indicates strength. ",
WriteIf (trendChange, "Indicates weakness. ",
WriteIf (noDemandBarUt, "A sign of Weakness. ",
WriteIf (noDemandBarDT, "A sign of Weakness. ",
WriteIf (stopVolume, "End of bearishnees near ",
WriteIf (revUpThrust, "End of bearishnees near ",
WriteIf (effortUp, "Bullish sign ",
WriteIf (effortDown , "Bearish sign ",
WriteIf (effortDownfail , "Bullish sign ",
WriteIf (effortUpfail, "Bearish sign ","")))))))))))))))))))))))))), "Signal" , 1,
colorDefault, tcolor,110);
AddTextColumn(
WriteIf (upThrustBar, " An Upthrust Bar. ",
WriteIf (upThrustCond1, " A downbar after an Upthrust. ",
WriteIf (upThrustCond2 AND NOT upThrustCond1, " A High Volume downbar after an
Upthrust.",
WriteIf (upThrustCond3, "This upthrust at very High Voume.",
WriteIf (strengthDown1, "Strength seen returning after a down trend. ",
WriteIf (strengthDown0 AND NOT strengthDown, "Strength seen returning after a down
trend. ",
WriteIf (strengthDown AND NOT strengthDown1, "Strength seen returning after a long
down trend. ",
WriteIf (lowVolTest , "Test for supply. ",
WriteIf (lowVolTest2, "An Upbar after sucessful Test, Confirms strength ",
WriteIf (buyCond, "Possible end of downtrend and start of uptrend soon",
WriteIf (Sellcond, "Possible end of Uptrend and start of Downtrend soon",
WriteIf (PseudoUpThrust, "Psuedo UpThrust. ",
WriteIf (topRevBar, "Top Reversal Bar. Caution. The probability of end of the
current upmove is High",
WriteIf (pseudoUtCond, "A Down Bar closing down after a Pseudo Upthrust. ",
WriteIf (lowVolTest1, "Test for supply in a uptrend. ",
WriteIf (strengthDown2, "High volume upbar closing on the high. ",
WriteIf (trendChange, "High volume Downbar after an upmove on high volume. ",
WriteIf (noDemandBarUt, "No Demand in a uptrend. A sign of Weakness. ",
WriteIf (noDemandBarDt, "No Demand. Uptrend unlikely soon. ",
WriteIf (stopVolume, "Stopping volume. ",
WriteIf (noSupplyBar, "No Supply. A sign of strength",
WriteIf (revUpThrust, "Reverse UpThrust. ",
WriteIf (effortUp, "Effort to Rise. ",
WriteIf (effortDown , "Effort to Fall. ",
WriteIf (effortUpfail, "Effort to Down up has failed. ",
WriteIf (effortUpfail, "Effort to Move up has failed.
","")))))))))))))))))))))))))), "Condition" , 1, colorDefault, tcolor,250);
_SECTION_END ();
//===========================================================================