_SECTION_BEGIN( "Ord Volume");
ZigPercent = Param( "Percent of Change for Zig", 4.6, 0, 50, 0.1 );
ZigUpColor = ParamColor( "Up Color", colorDarkBlue );
ZigDownColor = ParamColor( "Down Color", colorViolet );
ZerRedVol = Param( "Zeros to Reduce from Volume", 3, 0, 8, 1 );
SwingXoffset = Param( "Swing X Position", 3, -10, 30, 1 );
SwingYoffset = Param( "Swing Y Position", 1, 0, 30, 0.2 );
Color_LVT = ParamColor( "Leg Volume Text Color", colorWhite );
Color_LPTS = ParamColor( "Leg % Text Color Simple", colorGrey50 );
Color_LPTH = ParamColor( "Leg % Text Color Highlighted", colorBlack );
Color_LPBH = ParamColor( "Leg % Background Highlighted", colorYellow );
LegYoffset = Param( "Leg Y Position", 1.5, 0, 10, 0.1 );
RedVol = IIf( ZerRedVol == 0, 1,
IIf( ZerRedVol == 1, 10,
IIf( ZerRedVol == 2, 100,
IIf( ZerRedVol == 3, 1000,
IIf( ZerRedVol == 4, 10000,
IIf( ZerRedVol == 5, 100000,
IIf( ZerRedVol == 6, 1000000,
IIf( ZerRedVol == 7, 10000000,
IIf( ZerRedVol == 8, 100000000,
Null )))))))));
SimpleZigzag = Zig( C, ZigPercent );
HoL = IIf( SimpleZigzag > Ref(SimpleZigza g,-1), H, L );
bc = BarCount - 1 ;
MyZig = Zig( HoL, ZigPercent );
MyZig_Up = MyZig > Ref( MyZig, -1);
MyZig_Down = MyZig < Ref( MyZig, -1);
LastLegMid_Y_Po int = IIf( MyZig_Down, Peak( HoL, ZigPercent ) - ( (Peak( HoL, ZigPercent ) - L) / 2 ) ,
H - ( (H - Trough( HoL, ZigPercent )) / 2 ) );
PeakDef = ( MyZig > Ref(MyZig,-1) ) AND ( MyZig > Ref(MyZig,1) );
Peak1Vol = ValueWhen( PeakDef, V,1 );
Peak2Vol = ValueWhen( PeakDef, V,2 );
PeaksVolPerc = ( 100 * ( Peak1Vol - Peak2Vol ) / Peak2Vol );
TrouDef = ( MyZig < Ref(MyZig,-1) ) AND ( MyZig < Ref(MyZig,1) );
Trou1Vol = ValueWhen( TrouDef, V, 1 );
Trou2Vol = ValueWhen( TrouDef, V, 2 );
TrousVolPerc = ( 100 * ( Trou1Vol - Trou2Vol ) / Trou2Vol );
LastBarVolPerc = IIf( MyZig_Up,
( 100 * ( V - Peak1Vol ) / Peak1Vol ),
( 100 * ( V - Trou1Vol ) / Trou1Vol ) );
P1 = PeakBars (HoL, ZigPercent, 1) ;
T1 = TroughBars (HoL, ZigPercent, 1) ;
P2 = PeakBars (HoL, ZigPercent, 2) ;
T2 = TroughBars (HoL, ZigPercent, 2) ;
P1m1 = PeakBars (HoL, ZigPercent, 1) +1 ;
T1m1 = TroughBars (HoL, ZigPercent, 1) +1 ;
P2m1 = PeakBars (HoL, ZigPercent, 2) +1 ;
T2m1 = TroughBars (HoL, ZigPercent, 2) +1 ;
/* Last Leg */
LastLegBars = IIf( MyZig_Down, P1m1 , T1m1 );
LastLegVolAccum = IIf( MyZig_Down, Sum( V, P1m1 ) , Sum( V, T1m1) );
LastLegVolAVE = LastLegVolAccum / LastLegBars ;
/* Previous Leg */
PrevLegBars = IIf( MyZig_Down, (T2m1) - P1 , (P2m1) - T1 );
PrevLegVolAccum = IIf( MyZig_Down, Sum( V, (T2m1)) - Sum( V, P1 ) , Sum( V, (P2m1)) - Sum( V, T1 ) );
PrevLegVolAVE = PrevLegVolAccum / PrevLegBars ;
VolAVEChange1 = (LastLegVolAVE - PrevLegVolAVE) / PrevLegVolAVE * 100 ;
PrevLegBarsInc = IIf( MyZig_Down, (T1m1) - P1 , (P1m1) - T1 );
PrevLegVolAccum Inc = IIf( MyZig_Down, Sum( V, (T1m1)) - Sum( V, P1 ) , Sum( V, (P1m1)) - Sum( V, T1 ) );
PrevLegVolAVEIn c = PrevLegVolAccum Inc / PrevLegBarsInc ;
VolAVEChange1In c = (LastLegVolAVE - PrevLegVolAVEIn c) / PrevLegVolAVEInc * 100 ;
/* Previous Previous Leg */
PrPrLegBars = IIf( MyZig_Down, (P2m1) - T2 , (T2m1) - P2 );
PrPrLegVolAccum = IIf( MyZig_Down, Sum( V, (P2m1)) - Sum( V, T2 ) , Sum( V, (T2m1)) - Sum( V, P2 ) );
PrPrLegVolAVE = PrPrLegVolAccum / PrPrLegBars ;
VolAVEChange2 = (LastLegVolAVE - PrPrLegVolAVE) / PrPrLegVolAVE * 100 ;
PrPrLegBarsInc = IIf( MyZig_Down, (P2m1) - T1 , (T2m1) - P1 );
PrPrLegVolAccum Inc = IIf( MyZig_Down, Sum( V, (P2m1)) - Sum( V, T1 ) , Sum( V, (T2m1)) - Sum( V, P1 ) );
PrPrLegVolAVEIn c = PrPrLegVolAccum Inc / PrPrLegBarsInc ;
VolAVEChange2In c = (LastLegVolAVE - PrPrLegVolAVEIn c) / PrPrLegVolAVEInc * 100 ;
IIf( BarCount == LastValue( BarCount ), /////////// Incomplete Leg ---------=======
PlotText( "" + NumToStr( LastLegVolAVE[b c]/RedVol, 1.0),
BarCount - (LastLegBars[bc ]/2) ,
LastLegMid_Y_Po int[bc],
colorYellow ),
Null );
IIf( BarCount == LastValue( BarCount ),
PlotText( "" + NumToStr( VolAVEChange1In c[bc], 1.0) + "%",
BarCount - (LastLegBars[bc ]/2) ,
LastLegMid_Y_Po int[bc] * ( 1 - (LegYoffset/ 100) ),
IIf( VolAVEChange1In c[bc] <= -40, Color_LPTH, Color_LPTS ),
IIf( VolAVEChange1In c[bc] <= -40, Color_LPBH, Null ) ),
Null );
IIf( BarCount == LastValue( BarCount ),
PlotText( "" + NumToStr( VolAVEChange2In c[bc], 1.0) + "%",
BarCount - (LastLegBars[bc ]/2) ,
LastLegMid_Y_Po int[bc] * ( 1 - (2*LegYoffset/ 100) ),
IIf( VolAVEChange2In c[bc] <= -40, Color_LPTH, Color_LPTS ),
IIf( VolAVEChange2In c[bc] <= -40, Color_LPBH, Null ) ),
Null );
IIf( BarCount == LastValue( BarCount ),
PlotText( NumToStr( LastBarVolPerc[ bc], 1.0 ) + "%",
BarCount,
IIf( MyZig_Up[bc], H[bc]*(1+(Swing Yoffset/100)),
L[bc]*(1-(Swing Yoffset/100)) ),
IIf( LastBarVolPerc[ bc] <= -8, colorWhite, colorGrey50 ),
IIf( LastBarVolPerc[ bc] <= -8, colorRed, Null ) ),
Null );
for( i = 0; i < BarCount; i++ ) /////////// Legs ---------=================
{
if( PeakDef[i] OR TrouDef[i] )
PlotText( "" + NumToStr( LastLegVolAVE[i ]/RedVol, 1.0) + " ",
i - (LastLegBars[i] /2),
LastLegMid_Y_Po int[i],
Color_LVT
);
if( PeakDef[i] OR TrouDef[i] )
PlotText( "" + NumToStr( VolAVEChange1[i ], 1.0) + "%",
i - (LastLegBars[i] /2),
LastLegMid_Y_Po int[i] * ( 1 - (LegYoffset/ 100) ),
IIf( VolAVEChange1[i ] <= -40, Color_LPTH, Color_LPTS ),
IIf( VolAVEChange1[i ] <= -40, Color_LPBH, Null )
);
if( PeakDef[i] OR TrouDef[i] )
PlotText( "" + NumToStr( VolAVEChange2[i ], 1.0) + "%",
i - (LastLegBars[i] /2),
LastLegMid_Y_Po int[i] * ( 1 - (2*LegYoffset/ 100) ),
IIf( VolAVEChange2[i ] <= -40, Color_LPTH, Color_LPTS ),
IIf( VolAVEChange2[i ] <= -40, Color_LPBH, Null )
);
}
for( i = 0; i < BarCount; i++ ) /////////// Swings ---------=================
{
if( PeakDef[i] ) PlotText( NumToStr( PeaksVolPerc[i] , 1.0 ) + " %",
/ *NumToStr((V[i]/ RedVol),1.0) + " " + */
i-SwingXoffset,
H[i]*(1+(SwingY offset/100)),
IIf( PeaksVolPerc[i] <= -8, colorWhite, colorTeal ),
IIf( PeaksVolPerc[i] <= -8, colorRed, Null )
);
if( TrouDef[i] ) PlotText( NumToStr( TrousVolPerc[i] , 1.0 ) + " %",
/ *NumToStr((V[i]/ RedVol),1.0) + " " + */
i-SwingXoffset,
L[i]*(1-(SwingY offset/100)),
IIf( TrousVolPerc[i] <= -8, colorWhite, colorRed ),
IIf( TrousVolPerc[i] <= -8, colorDarkOliveG reen, Null )
);
}
LastBarVolPerc = IIf( MyZig_Up,
( 100 * ( V - Peak1Vol ) / Peak1Vol ),
( 100 * ( V - Trou1Vol ) / Trou1Vol ) );
SwingBreakUp = H > Peak( HoL, ZigPercent );
SwingBreakDn = L < Trough( HoL, ZigPercent );
/////////////// //////////////// //////////////// //////
Plot( MyZig, "%Change("+NumT oStr(ZigPercent ,1.1)+"%)", IIf( MyZig_Up, ZigUpColor, ZigDownColor ) );
Plot( Close, "Close", colorWhite, styleCandle );
Plot( MyZig + ( MyZig * 0.05 ), "", colorRed, styleNoDraw);
Plot( MyZig - ( MyZig * 0.05), "", colorRed, styleNoDraw);
_SECTION_END();
ZigPercent = Param( "Percent of Change for Zig", 4.6, 0, 50, 0.1 );
ZigUpColor = ParamColor( "Up Color", colorDarkBlue );
ZigDownColor = ParamColor( "Down Color", colorViolet );
ZerRedVol = Param( "Zeros to Reduce from Volume", 3, 0, 8, 1 );
SwingXoffset = Param( "Swing X Position", 3, -10, 30, 1 );
SwingYoffset = Param( "Swing Y Position", 1, 0, 30, 0.2 );
Color_LVT = ParamColor( "Leg Volume Text Color", colorWhite );
Color_LPTS = ParamColor( "Leg % Text Color Simple", colorGrey50 );
Color_LPTH = ParamColor( "Leg % Text Color Highlighted", colorBlack );
Color_LPBH = ParamColor( "Leg % Background Highlighted", colorYellow );
LegYoffset = Param( "Leg Y Position", 1.5, 0, 10, 0.1 );
RedVol = IIf( ZerRedVol == 0, 1,
IIf( ZerRedVol == 1, 10,
IIf( ZerRedVol == 2, 100,
IIf( ZerRedVol == 3, 1000,
IIf( ZerRedVol == 4, 10000,
IIf( ZerRedVol == 5, 100000,
IIf( ZerRedVol == 6, 1000000,
IIf( ZerRedVol == 7, 10000000,
IIf( ZerRedVol == 8, 100000000,
Null )))))))));
SimpleZigzag = Zig( C, ZigPercent );
HoL = IIf( SimpleZigzag > Ref(SimpleZigza
bc = BarCount - 1 ;
MyZig = Zig( HoL, ZigPercent );
MyZig_Up = MyZig > Ref( MyZig, -1);
MyZig_Down = MyZig < Ref( MyZig, -1);
LastLegMid_Y_Po
H - ( (H - Trough( HoL, ZigPercent )) / 2 ) );
PeakDef = ( MyZig > Ref(MyZig,-1) ) AND ( MyZig > Ref(MyZig,1) );
Peak1Vol = ValueWhen( PeakDef, V,1 );
Peak2Vol = ValueWhen( PeakDef, V,2 );
PeaksVolPerc = ( 100 * ( Peak1Vol - Peak2Vol ) / Peak2Vol );
TrouDef = ( MyZig < Ref(MyZig,-1) ) AND ( MyZig < Ref(MyZig,1) );
Trou1Vol = ValueWhen( TrouDef, V, 1 );
Trou2Vol = ValueWhen( TrouDef, V, 2 );
TrousVolPerc = ( 100 * ( Trou1Vol - Trou2Vol ) / Trou2Vol );
LastBarVolPerc = IIf( MyZig_Up,
( 100 * ( V - Peak1Vol ) / Peak1Vol ),
( 100 * ( V - Trou1Vol ) / Trou1Vol ) );
P1 = PeakBars (HoL, ZigPercent, 1) ;
T1 = TroughBars (HoL, ZigPercent, 1) ;
P2 = PeakBars (HoL, ZigPercent, 2) ;
T2 = TroughBars (HoL, ZigPercent, 2) ;
P1m1 = PeakBars (HoL, ZigPercent, 1) +1 ;
T1m1 = TroughBars (HoL, ZigPercent, 1) +1 ;
P2m1 = PeakBars (HoL, ZigPercent, 2) +1 ;
T2m1 = TroughBars (HoL, ZigPercent, 2) +1 ;
/* Last Leg */
LastLegBars = IIf( MyZig_Down, P1m1 , T1m1 );
LastLegVolAccum
LastLegVolAVE = LastLegVolAccum
/* Previous Leg */
PrevLegBars = IIf( MyZig_Down, (T2m1) - P1 , (P2m1) - T1 );
PrevLegVolAccum
PrevLegVolAVE = PrevLegVolAccum
VolAVEChange1 = (LastLegVolAVE - PrevLegVolAVE) / PrevLegVolAVE * 100 ;
PrevLegBarsInc = IIf( MyZig_Down, (T1m1) - P1 , (P1m1) - T1 );
PrevLegVolAccum
PrevLegVolAVEIn
VolAVEChange1In
/* Previous Previous Leg */
PrPrLegBars = IIf( MyZig_Down, (P2m1) - T2 , (T2m1) - P2 );
PrPrLegVolAccum
PrPrLegVolAVE = PrPrLegVolAccum
VolAVEChange2 = (LastLegVolAVE - PrPrLegVolAVE) / PrPrLegVolAVE * 100 ;
PrPrLegBarsInc = IIf( MyZig_Down, (P2m1) - T1 , (T2m1) - P1 );
PrPrLegVolAccum
PrPrLegVolAVEIn
VolAVEChange2In
IIf( BarCount == LastValue( BarCount ), ///////////
PlotText( "" + NumToStr( LastLegVolAVE[b
BarCount - (LastLegBars[bc
LastLegMid_Y_Po
colorYellow ),
Null );
IIf( BarCount == LastValue( BarCount ),
PlotText( "" + NumToStr( VolAVEChange1In
BarCount - (LastLegBars[bc
LastLegMid_Y_Po
IIf( VolAVEChange1In
IIf( VolAVEChange1In
Null );
IIf( BarCount == LastValue( BarCount ),
PlotText( "" + NumToStr( VolAVEChange2In
BarCount - (LastLegBars[bc
LastLegMid_Y_Po
IIf( VolAVEChange2In
IIf( VolAVEChange2In
Null );
IIf( BarCount == LastValue( BarCount ),
PlotText( NumToStr( LastBarVolPerc[
BarCount,
IIf( MyZig_Up[bc], H[bc]*(1+(Swing
L[bc]*(1-(Swing
IIf( LastBarVolPerc[
IIf( LastBarVolPerc[
Null );
for( i = 0; i < BarCount; i++ ) ///////////
{
if( PeakDef[i] OR TrouDef[i] )
PlotText( "" + NumToStr( LastLegVolAVE[i
i - (LastLegBars[i]
LastLegMid_Y_Po
Color_LVT
);
if( PeakDef[i] OR TrouDef[i] )
PlotText( "" + NumToStr( VolAVEChange1[i
i - (LastLegBars[i]
LastLegMid_Y_Po
IIf( VolAVEChange1[i
IIf( VolAVEChange1[i
);
if( PeakDef[i] OR TrouDef[i] )
PlotText( "" + NumToStr( VolAVEChange2[i
i - (LastLegBars[i]
LastLegMid_Y_Po
IIf( VolAVEChange2[i
IIf( VolAVEChange2[i
);
}
for( i = 0; i < BarCount; i++ ) ///////////
{
if( PeakDef[i] ) PlotText( NumToStr( PeaksVolPerc[i]
/
i-SwingXoffset,
H[i]*(1+(SwingY
IIf( PeaksVolPerc[i]
IIf( PeaksVolPerc[i]
);
if( TrouDef[i] ) PlotText( NumToStr( TrousVolPerc[i]
/
i-SwingXoffset,
L[i]*(1-(SwingY
IIf( TrousVolPerc[i]
IIf( TrousVolPerc[i]
);
}
LastBarVolPerc = IIf( MyZig_Up,
( 100 * ( V - Peak1Vol ) / Peak1Vol ),
( 100 * ( V - Trou1Vol ) / Trou1Vol ) );
SwingBreakUp = H > Peak( HoL, ZigPercent );
SwingBreakDn = L < Trough( HoL, ZigPercent );
///////////////
Plot( MyZig, "%Change("+NumT
Plot( Close, "Close", colorWhite, styleCandle );
Plot( MyZig + ( MyZig * 0.05 ), "", colorRed, styleNoDraw);
Plot( MyZig - ( MyZig * 0.05), "", colorRed, styleNoDraw);
_SECTION_END();
Comments
Post a Comment