.

Composite Fibonacci Volume Spike Indicator - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Composite Fibonacci Volume Spike Indicator

_SECTION_BEGIN("Background");
 SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle|chartHideQuoteMarker);
dy=ParamToggle("NR calc for", "RT SCAN|EOD SCAN", 0);
TT=IIf(dy==0,in15Minute,inDaily);
no=Param("NR days filter",0,0,4,1);
Limit=Param(" Trade Till (Hour)(Min)(Sec)",153000,103000,153000,100);
since=(TimeNum() >= 084500 AND TimeNum()<= Limit) AND (DateNum()==LastValue(DateNum()));
perc= Param("Red-Green ratio % Set", 35, 0, 100, 1 );
inv=Param("INVEST CAPITAL", 23000,1000, 1000000, 500 );

 SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border 
 SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
 tchoice=Param("Title Selection ",2,1,2,1);

_SECTION_BEGIN("Haiken");

Show_color = ParamToggle("Display CandleColor", "No|Yes", 0);
r1 = Param( "ColorFast avg", 5, 2, 200, 1 );
r2 = Param( "ColorSlow avg", 10, 2, 200, 1 );
r3 = Param( "ColorSignal avg", 5, 2, 200, 1 );

Prd1=Param("ATR Period",4,1,20,1);
Prd2=Param("Look Back",7,1,20,1);
greenD = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2);
redD = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2);

HaClose =EMA((O+H+L+C)/4,3);  // Woodie 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );  
HaHigh = Max( H, Max( HaClose, HaOpen ) ); 
HaLow = Min( L, Min( HaClose, HaOpen ) ); 
Temp = Max(High, HaOpen);
Temp = Min(Low,HaOpen);
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND m1>s1,colorLime,IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));


if(Show_color)

{
ColorHighliter = myColor;
SetBarFillColor( ColorHighliter );
}
//////////

barColor=IIf(C>GreenD ,colorBrightGreen,IIf(C < REDD,colorRed,colorYellow));
barColor2=IIf(CCI(14) > ((Ref(CCI(14),-1)+Ref(CCI(14),-2))/2),colorAqua,colorBrown);


if( ParamToggle("Plot Normal Candle", "No,Yes", 0 ) )
  PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, " " , barcolor, styleCandle | styleThick );
else
PlotOHLC( Open, High, Low, Close, " " , barcolor2, styleCandle | styleThick );

_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), IIf( C > O,colorGreen, colorRed), ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram  ), 2 );
Plot( OBV(), _DEFAULT_NAME(), ParamColor("OBV Color", colorCycle ), styleDashed| styleOwnScale | styleThick | styleNoLabel  );
_SECTION_END();
_SECTION_BEGIN("Chaikin Volatility");
periods= Param("Periods", 10, 2, 100 );
function ChaikinVolatility( periods )
{
 return ROC( EMA( High - Low, periods ), periods );
}

Plot( ChaikinVolatility(periods ),_DEFAULT_NAME(), colorYellow,styleLine| styleOwnScale | styleThick | styleNoLabel  );
 
_SECTION_END();
TimeFrameSet(in5Minute);
//TimeFrameSet(in5Minute);
since5=(TimeNum() >= 090000 AND TimeNum()<= 153000) AND (DateNum()==LastValue(DateNum()));
Candles5=(since5 & (C<O | C>O | C==O));
Candles51=Cum(Candles5);
HaClose0 =EMA((O+H+L+C)/4,3); 
HaOpen0 = AMA( Ref( HaClose0, -1 ), 0.5 ); 
HaHigh0 = Max( H, Max( HaClose0, HaOpen0 ) ); 
HaLow0 = Min( L, Min( HaClose0, HaOpen0 ) ); 
CondB=Haopen0<Haclose0;CONDS=Haopen0 >Haclose0;
TimeFrameRestore();


_SECTION_BEGIN("2");
//Compress= Param("Compression",3,0.20,100,0.10); 
TimeFrameSet(in15Minute);
since15=(TimeNum() >= 090000 AND TimeNum()<= 153000) AND (DateNum()==LastValue(DateNum()));
Candles15=(since15 & (C<O | C>O | C==O));
Candles115=Cum(Candles15);
HaClose1 =EMA((O+H+L+C)/4,3); 
HaOpen1 = AMA( Ref( HaClose1, -1 ), 0.5 ); 
HaHigh1 = Max( H, Max( HaClose1, HaOpen1 ) ); 
HaLow1 = Min( L, Min( HaClose1, HaOpen1 ) ); 
CondB1=Haopen1 < Haclose1;CONDS1=Haopen1 >Haclose1;
TimeFrameRestore();

_SECTION_BEGIN("3");
//Compress= Param("Compression",6,0.20,100,0.10); 
TimeFrameSet(in15Minute*2);
since2=(TimeNum() >= 090000 AND TimeNum()<= 153000) AND (DateNum()==LastValue(DateNum()));
Candles2=(since2 & (C<O | C>O | C==O));
Candles12=Cum(Candles2);
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 ) ); 
CondB2=Haopen2 < Haclose2;CONDS2=Haopen2 > Haclose2;
TimeFrameRestore();


_SECTION_BEGIN("4");
//Compress= Param("Compression",12,0.20,100,0.10); 
TimeFrameSet(inHourly);
since3=(TimeNum() >= 090000 AND TimeNum()<= 153000) AND (DateNum()==LastValue(DateNum()));
Candles3=(since3 & (C<O | C>O | C==O));
Candles13=Cum(Candles3);
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 ) ); 
CondB3=Haopen3 < Haclose3;CONDS3=Haopen3 > Haclose3;
TimeFrameRestore();
//patterns

_SECTION_BEGIN("Pattern Alerts");
SRbS = ParamToggle("S/R broken","Off,On",1);
SRcS = ParamToggle("S/R confirmed","Off,On",1);
PjabS = ParamToggle("Price just above/below","Off,On",1);
_SECTION_END();

_SECTION_BEGIN("Pattern Parameters");
PlotP1P2 = ParamToggle("Plot P1/P2 Shapes","Off,On",0);
P1Shape = Param("P1 Shape Typ",35,0,50,1);//default 35
P2Shape = Param("P2 Shape Typ",37,0,50,1);//default 37
Parallellinesswitch = ParamToggle("Plot Parallel Lines","Off,On",0);
DisRange = Param("Plot Parallel Lines Trigger",300,0,1000,20);

_SECTION_BEGIN("Pattern Styles");
Style_SL= ParamStyle("Support",styleLine+styleThick,maskDefault)+styleNoRescale;
Style_RL= ParamStyle("Resistance",styleLine+styleThick,maskDefault)+styleNoRescale;
Style_PHL= ParamStyle("Parallel Support",styleLine+styleDashed,maskDefault)+styleNoRescale;
Style_PLL= ParamStyle("Parallel Resistance",styleLine+styleDashed,maskDefault)+styleNoRescale;
_SECTION_END();


_SECTION_BEGIN("Pattern Selection");
AscTs = ParamToggle("Ascending Triangle","Off,On",1);
DscTs = ParamToggle("Descending Triangle","Off,On",1);
STs = ParamToggle("Symmetrically Triangle","Off,On",1);
ETs = ParamToggle("Expanding Triangle","Off,On",1);
RWs = ParamToggle("Rising Wedge","Off,On",1);
FWs = ParamToggle("Falling Wedge","Off,On",1);
UTs = ParamToggle("Up Trend","Off,On",1);
DTs = ParamToggle("Down Trend","Off,On",1);
Ranges = ParamToggle("Range","Off,On",1);
NonDefinedPatterns = ParamToggle("Not defined Patterns","Off,On",1);
_SECTION_END();
//calcs
HH = HHV(H,20);
LL = LLV(L,20);
Mid = LL+((HH-LL)/2);
Div = 100-(HH/(0.01*Mid));
Per = LastValue(abs(Div));
Hp1 = Ref(H,-1);Hp2 = Ref(H,-2);Hp3 = Ref(H,-3);Hp4 = Ref(H,-4);Hp5 = Ref(H,-5);Hp6 = Ref(H,-6);
Lp1 = Ref(L,-1);Lp2 = Ref(L,-2);Lp3 = Ref(L,-3);Lp4 = Ref(L,-4);Lp5 = Ref(L,-5);Lp6 = Ref(L,-6);
Hf1 = Ref(H,1);Hf2 = Ref(H,2);Hf3 = Ref(H,3);Hf4 = Ref(H,4);Hf5 = Ref(H,5);Hf6 = Ref(H,6);
Lf1 = Ref(L,1);Lf2 = Ref(L,2);Lf3 = Ref(L,3);Lf4 = Ref(L,4);Lf5 = Ref(L,5);Lf6 = Ref(L,6);
x = Cum(1);
divx = LastValue(x)-x;

//Tops
A = H;
Top1 = A > Hf2 & A > Hf1 & A > Hp1 & A > Hp2 & divx>2;
Top2 = A > Hf3 & A > Hf2 & A ==Hf1 & A > Hp1 & A > Hp2 & divx>3 ;
Top3 = A > Hf4 & A > Hf3 & A ==Hf2 & A >=Hf1 & A > Hp1 & A > Hp2 & divx>4;
Top4 = A > Hf5 & A > Hf4 & A ==Hf3 & A >=Hf2 & A >=Hf1 & A > Hp1 & A > Hp2 & divx>5;
Top5 = A > Hf6 & A > Hf5 & A ==Hf4 & A >=Hf3 & A ==Hf2 & A >=Hf1 & A > Hp1 & A >Hp2 & divx>6;
Top = Top1 OR Top2 OR Top3 OR Top4 OR Top5;
TopHigh = ValueWhen(Top,H);
TopX = ValueWhen(Top,X);

//Valleys
A = L;
Valley1 = A < Lf2 & A <= Lf1 & A <= Lp1 & A < Lp2 & divx>2;
Valley2 = A < Lf3 & A < Lf2 & A == Lf1 & A < Lp1 & A < Lp2 & divx>3;
Valley3 = A < Lf4 & A < Lf3 & A == Lf2 & A <= Lf1 & A < Lp1 & A < Lp2 & divx>4;
Valley4 = A < Lf5 & A < Lf4 & A == Lf3 & A <= Lf2 & A <= Lf1 & A < Lp1 & A < Lp2 & divx>5;
Valley5 = A < Lf6 & A < Lf5 & A == Lf4 & A <= Lf3 & A == Lf2 & A <= Lf1 & A < Lp1 & A < Lp2 & divx>6;
Valley = Valley1 OR Valley2 OR Valley3 OR Valley4 OR Valley4 OR Valley5;
ValleyLow = ValueWhen(Valley,L);
ValleyX = ValueWhen(Valley,X);
x = Cum(1);
xb = LastValue(ValueWhen(Valley,x,1));
xa = LastValue(ValueWhen(Valley,x,2));
yb = LastValue(ValueWhen(Valley,L,1));
Ya = LastValue(ValueWhen(Valley,L,2));
xab_log = log(yb/yA)/(xb-xa);
SL = exp((x-xb)*xab_log)*yb;
RocSL = ROC(SL,1);
xd = LastValue(ValueWhen(top,x,1));
xc = LastValue(ValueWhen(top,x,2));
yd = LastValue(ValueWhen(top,H,1));
Yc = LastValue(ValueWhen(top,H,2));
xcd_log = log(yd/yc)/(xd-xc);
RL = exp((x-xd)*xcd_log)*yd;
RocRL = ROC(RL,1);

//LPL
Low_Value = LastValue(Ref(LLV(L,xd-xc),-(x-xd)));
x2 = LastValue(ValueWhen(L==Low_Value & x>xc & x<xd,x));
PLL = IIf(LastValue(x)-x2>5,exp((x-x2)*xcd_log)*Low_Value,-1e10);

//HPL
Hi_Value = LastValue(Ref(HHV(H,xb-xa),-(x-xb)));
x3 = LastValue(ValueWhen(H==Hi_Value & x>xa & x<xb,x));
PHL = IIf(LastValue(x)-x3>5,exp((x-x3)*xab_log)*Hi_Value,-1e10);

//Channels
AvgRoc = abs(MA(ROC(C,1),100));
Threshold_parallel = 15;
Threshold_Trend = 0.001*per;
SLabs = SL-Ref(SL,-1); RLabs = RL-Ref(RL,-1);
ROC2SL = (SLabs/C)*100; ROC2RL = (RLabs/C)*100;
RSL = ROC2SL > Threshold_Trend; FlatSL = abs(ROC2SL) < Threshold_Trend; FSL = ROC2SL < -Threshold_Trend;
RRL = ROC2RL > Threshold_Trend; FlatRL = abs(ROC2RL) < Threshold_Trend; FRL = ROC2RL < -Threshold_Trend;
parallel= abs(((RocSL/RocRL)-1)*100)<Threshold_parallel;
UT= RSL AND RRL AND parallel;
DT= FSL AND FRL AND parallel;
DT_UT = IIf (DT,-1,IIf(UT,1,0));
Rangeee = parallel AND FlatSL AND FlatRL;
Xm = xb-xa >4 & xd-xc >4; //x-min.distance - optional
AscT= FlatRL & RSL;// & xa<xd & xc<xb;// & Xm;
DscT= FlatSL & FRL;// & xa<xd & xc<xb;// & Xm;
AT_DT= IIf(AscT,1,IIf(DscT,-1,0));
ST = RSL & FRL & RL>SL;//& xa<xd & xc<xb;// & Xm;
ET = RRL & FSL & RL>SL;//& xa<xd & xc<xb;// & Xm;//abs(ROCSL/ROCRL)<3 - optional
ST_ET = IIf(ST,1,IIf(ET,-1,0));
RW = RRL & RSL & RocSL>RocRL & SL>RL AND NOT parallel;// & Xm;
FW = FSL & FRL & RocRL<RocSL & SL<RL AND NOT parallel;// & Xm;
RW_FW = IIf (RW,1,IIf(FW,-1,0));
Distance = 0.5*ATR(14);

//Support line signals
Sup_break = Cross(SL,C) & X>XB;
Sup_pricejustabove = L<SL+Distance & L>SL & X>XB;
Sup_confirmed = L<=SL & C>SL & X>XB;

//Resistance line signals
Res_break = Cross(C,RL) & X>XD;
Res_pricejustbelow = H>RL-Distance & H<RL & X>XD;
Res_confirmed = H>=RL & C<RL & X>XD;

//Parallel lower line signals
PLL_break = Cross(PLL,C);
PLL_pricejustabove = L<PLL+Distance & L>PLL;
PLL_confirmed = L<=PLL & C>PLL;

//Parallel higher line signals
PHL_break = Cross(C,PHL);
PHL_pricejustbelow = H>PHL-Distance & H<PHL;
PHL_confirmed = H>=PHL & C<PHL;
SupSignals = Sup_break | Sup_pricejustabove | Sup_confirmed;
ResSignals = Res_break | Res_pricejustbelow | Res_confirmed;
PLLSignals = PLL_break | PLL_pricejustabove | PLL_confirmed;
PHLSignals = PHL_break | PHL_pricejustbelow | PHL_confirmed;
//BS = Sup_confirmed OR Res_break;
//SS = Res_confirmed OR Sup_break;
BS = Sup_confirmed OR Sup_pricejustabove OR Res_break;
SS = Res_confirmed OR Res_pricejustbelow OR Sup_break;
NS = Sup_pricejustabove OR Res_pricejustbelow;
PatternDirection =
IIf(AscT|FW|UT,1,
IIf(DscT|RW|DT,-1,
IIf(ST|ET|Rangeee,0,0)));


//Display Cond. fix when Chart is compl.zoomed out
PLLd = abs((LastValue(C)/LastValue(PLL))-1)<0.01*DisRange;
PHLd = abs((LastValue(C)/LastValue(PHL))-1)<0.01*DisRange;
barvisible = Status("barvisible");
firstvisiblebar = barvisible & NOT
Ref(barvisible,-1);
HHvisible = LastValue(HighestSince(firstvisiblebar,High));
LLvisible = LastValue(LowestSince(firstvisiblebar,Low));
RaH = HHvisible *1.05; //Range High
RaL = LLVisible *0.95; //Range Low

//Anyline_zero
AnZ= ya==0 OR yb==0 OR yc==0 OR yd==0;
SL_plot = IIf(x>=xa & SL>RaL & SL<RaH & NOT AnZ,SL,IIf(x>=xa & RaL==0 & NOT AnZ,SL,-1e10));
RL_plot = IIf(x>=xc & RL>RaL & RL<RaH & NOT AnZ,RL,IIf(x>=xc & RaL==0 & NOT AnZ,RL,-1e10));
PLL_plot = IIf(x-x2>=0 & abs(LastValue(L/PLL)-1) <abs(LastValue((DisRange/1000)*ATR(14))) & PLL>RaL & PLL<RaH & NOT AnZ,PLL,IIf(x-x2>=0 & RaL==0 & PLLd & abs(LastValue(L/PLL)-1) <abs(LastValue((DisRange/1000)*ATR(14)))& NOT AnZ,PLL,-1e10));
PHL_plot = IIf(x-x3>=0 & abs(LastValue(H/PHL)-1) <abs(LastValue((DisRange/1000)*ATR(14))) & PHL>RaL & PHL<RaH & NOT AnZ,PHL,IIf(x-x3>=0 & RaL==0 & PHLd & abs(LastValue(H/PHL)-1) <abs(LastValue((DisRange/1000)*ATR(14)))& NOT AnZ,PHL,-1e10));

///////////Begin Ploting Part////////////

LastBar = Cum(1) == LastValue(Cum(1));
Plot(SL_plot ," SL" ,colorCustom13,Style_SL+styleNoTitle);
Plot(RL_plot ," RL" ,colorCustom12,Style_RL+styleNoTitle);
Plot(IIf(Parallellinesswitch,PLL_plot,-1e10)," PLL",colorCustom13,Style_PLL+styleNoTitle);
Plot(IIf(Parallellinesswitch,PHL_plot,-1e10)," PHL",colorCustom12,Style_PHL+styleNoTitle);

// Shading
BEGIN=Min(xa,xc);
TRS = IIf(x>BEGIN-1,SL,-1e10);
TRR = IIf(x>BEGIN-1,RL,-1e10);
trr = IIf(trr>0,trr,Null);
yVal=IIf(trs > trr,trr,trs);
yval = IIf(yval>0,yval,Null);
GraphZOrder = 0;
if(Version()>4.75){
//PlotOHLC(0,trr,yval,0,"",Shadowcolor,styleCloud+styleNoLabel);
}
///////////End Ploting Part////////////
DefinedPatterns = AscT | DscT | ST | ET | RW | FW | UT | DT;
Filter = BarIndex()==LastValue(BarIndex()) AND NOT GroupID()==253;
Filter = Filter AND
(AscT AND AscTs)| (DscT AND DscTs)| (ST AND STs)|
(ET AND ETs)| (RW AND RWs)| (FW AND FWs)|
(UT AND UTs)| (DT AND DTs)|(Rangeee AND Ranges)|
(SupSignals AND NonDefinedPatterns AND NOT DefinedPatterns)|
(ResSignals AND NonDefinedPatterns AND NOT DefinedPatterns);
// | PLLSignals | PHLSignals | Trade Variables

//Shapes
if(PlotP1P2){
PlotShapes(IIf(x==xa & NOT AnZ,P1Shape,shapeNone),Color_SL,0,SL,-13 );
PlotShapes(IIf(x==xc & NOT AnZ,P1Shape,shapeNone),Color_RL,0,H,13 );
}
//end pattern
//////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Fib Retracements");
 fibs = ParamToggle("Plot Fibs","Off|On",1);
 pctH = Param ("Pivot Hi %", 0.325,0.001,2.0,0.002);
 HiLB = Param ("Hi LookBack",1,1,BarCount-1,1);
 pctL = Param ("Pivot Lo %", 0.325,0.001,2.0,0.002);
 LoLB = Param ("Lo LookBack",1,1,BarCount-1,1);
 Back = Param ("Extend Left = 2",1,1,500,1);
 Fwd  = Param("Plot Forward", 0, 0, 500, 1);
 text = ParamToggle("Plot Text","Off|On",1);
 hts  = Param ("Text Shift", -33.5,-50,50,0.10);
 style =ParamStyle("Line Style",styleLine,styleNoLabel);
x = BarIndex();
pRp  = PeakBars( H, pctH, 1) == 0;
yRp0 = SelectedValue(ValueWhen( pRp, H, HiLB));
xRp0 = SelectedValue(ValueWhen( pRp, x, HiLB));
pSp  = TroughBars( L, pctL, 1) == 0;
ySp0 = SelectedValue(ValueWhen( pSp, L, LoLB));
xSp0 = SelectedValue(ValueWhen( pSp, x, LoLB));
Delta = yRp0 - ySp0;

function fib(ret)
{
retval = (Delta * ret);
Fibval = IIf(ret < 1.0 
AND xSp0 < xRp0, yRp0 - retval, IIf(ret < 1.0 
AND xSp0 > xRp0, ySp0 + retval,IIf(ret > 1.0 
AND xSp0 < xRp0, yRp0 - retval, IIf(ret > 1.0 
AND xSp0 > xRp0, ySp0 + retval, Null)))); 
return FibVal;
}

x0 = Min(xSp0,xRp0)-Back;
x1 = (BarCount -1);
//////////////////////////////////////////////////////////////////
r236 = fib(0.236); r236I = LastValue (r236,1);
r382 = fib(0.382); r382I = LastValue (r382,1);
r050 = fib(0.50);  r050I = LastValue (r050,1);
r618 = fib(0.618); r618I = LastValue (r618,1);
r786 = fib(0.786); r786I = LastValue (r786,1);
e127 = fib(1.27);  e127I = LastValue (e127,1);
e162 = fib(1.62);  e162I = LastValue (e162,1);
e200 = fib(2.00);  e200I = LastValue (e200,1);
e262 = fib(2.62);  e262I = LastValue (e262,1);
e424 = fib(4.24);  e424I = LastValue (e424,1);
//////////////////////////////////////////////////////////////////
p00 = IIf(xSp0 > xRp0,ySp0,yRp0);  p00I = LastValue (p00,1);
p100 = IIf(xSp0 < xRp0,ySp0,yRp0);  p100I = LastValue (p100,1);
color00 =IIf(xSp0 > xRp0,colorLime,colorRed);
color100 =IIf(xSp0 < xRp0,colorLime,colorRed);
//////////////////////////////////////////////////////////////////
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
//////////////////////////////////////////////////////////////////
Col=IIf(p00<p100,43,32);

if(fibs==1)
{
Plot(LineArray(xRp0-Fwd,yRp0,x1,yRp0,Back),"PR",Col,8|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(xSp0-Fwd,ySp0,x1,ySp0,Back),"PS",Col,8|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r236,x1,r236,Back),"",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r382,x1,r382,Back),"",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r050,x1,r050,Back),"",41,styleDots|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r618,x1,r618,Back),"",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r786,x1,r786,Back),"",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e127,x1,e127,Back),"e127",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e162,x1,e162,Back),"e162",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e200,x1,e200,Back),"p200",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e262,x1,e262,Back),"p262",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,e424,x1,e424,Back),"p424",Col,styleDashed|styleNoRescale,Null, Null,Fwd);
}
//////////////////////////////////////////////////////////////////
if(text==1)
{ 
PlotText(" 0% = " + WriteVal(p00,fraction),  LastValue(BarIndex())-(numbars/hts), p00I  + 0.05, col);
PlotText("23% = " + WriteVal(r236,fraction), LastValue(BarIndex())-(numbars/hts), r236I + 0.05, Col);
PlotText("38% = " + WriteVal(r382,fraction), LastValue(BarIndex())-(numbars/hts), r382I + 0.05, Col);
PlotText("50% = " + WriteVal(r050,fraction), LastValue(BarIndex())-(numbars/hts), r050I + 0.05, Col);
PlotText("62% = " + WriteVal(r618,fraction), LastValue(BarIndex())-(numbars/hts), r618I + 0.05, Col);
PlotText("78% = " + WriteVal(r786,fraction), LastValue(BarIndex())-(numbars/hts), r786I + 0.05, Col);
PlotText("100% = " + WriteVal(p100,fraction), LastValue(BarIndex())-(numbars/hts),p100I + 0.05, col);
PlotText("127% = " + WriteVal(e127,fraction), LastValue(BarIndex())-(numbars/hts),e127I + 0.05, Col);
PlotText("162% = " + WriteVal(e162,fraction), LastValue(BarIndex())-(numbars/hts),e162I + 0.05, Col);
PlotText("200% = " + WriteVal(e200,fraction), LastValue(BarIndex())-(numbars/hts),e200I + 0.05, Col);
PlotText("262% = " + WriteVal(e262,fraction), LastValue(BarIndex())-(numbars/hts),e262I + 0.05, Col);
PlotText("424% = " + WriteVal(e424,fraction), LastValue(BarIndex())-(numbars/hts),e424I + 0.05, Col);
}
_SECTION_END();

//////////////////////////////////////////////////////////////////

_SECTION_BEGIN("Volume Price Analysis");
//=======================================================================================
DTL=Param("Linear regression period",60,10,100,10); 
wbf=Param("WRB factor",1.5,1.3,2.5,.1);
nbf=Param("NRB factor",0.7,0.3,0.9,0.1);
TL=LinRegSlope(MA(C, DTL),2); 
 Vlp=Param("Volume lookback period",30,20,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp); 
Vp3 = Vrg + 3*st; 
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st; 
Vn2 = Vrg -2*st; 
_SECTION_END();

//nr7 setup

TimeFrameSet(TT);
High1=IIf(O>H,O,H);
Low1=IIf(O<L,O,L);
rang=High1-Low1;
nr7=(rang==LLV(rang,7));
nr8=(Ref(nr7,-1)  AND rang==LLV(rang,8));
InsideBar = Inside() ;
nri=(nr7 AND InsideBar);
G=C>O;
R=C<O;
TGN7=nr7 & G;
TRN7=nr7 & R;
TGN8=nr8 & G;
TRN8=nr8 & R;
TGN7i=nri & G;
TRN7i=nri & R;

YGN7=Ref(TGN7,-1);
YRN7=Ref(TRN7,-1);
YGN8=Ref(TGN8,-1);
YRN8=Ref(TRN8,-1);
YGN7i=Ref(TGN7i,-1);
YRN7i=Ref(TRN7i,-1);

zGN7=Ref(TGN7,-2);
zRN7=Ref(TRN7,-2);
zGN8=Ref(TGN8,-2);
zRN8=Ref(TRN8,-2);
zGN7i=Ref(TGN7i,-2);
zRN7i=Ref(TRN7i,-2);

aGN7=Ref(TGN7,-3);
aRN7=Ref(TRN7,-3);
aGN8=Ref(TGN8,-3);
aRN8=Ref(TRN8,-3);
aGN7i=Ref(TGN7i,-3);
aRN7i=Ref(TRN7i,-3);

bGN7=Ref(TGN7,-4);
bRN7=Ref(TRN7,-4);
bGN8=Ref(TGN8,-4);
bRN8=Ref(TRN8,-4);
bGN7i=Ref(TGN7i,-4);
bRN7i=Ref(TRN7i,-4);

Cgn7=IIf(dy & no==0,tgn7,0);
Crn7=IIf(dy & no==0,trn7,0);
Cgn8=IIf(dy & no==0,tgn8,0);
Crn8=IIf(dy & no==0,trn8,0);
Cgn7i=IIf(dy & no==0,tgn7i,0);
Crn7i=IIf(dy & no==0,trn7i,0);

dgn7=IIf(dy & no==1,tgn7 & ygn7,0);
drn7=IIf(dy & no==1,trn7 & yrn7,0);
dgn8=IIf(dy & no==1,tgn8 & ygn8,0);
drn8=IIf(dy & no==1,trn8 & yrn8,0);
dgn7i=IIf(dy & no==1,tgn7i & ygn7i,0);
drn7i=IIf(dy & no==1,trn7i & yrn7i,0);

egn7=IIf(dy & no==2,tgn7 & ygn7 & zgn7,0);
ern7=IIf(dy & no==2,trn7 & yrn7 & zrn7,0);
egn8=IIf(dy & no==2,tgn8 & ygn8 & zgn8,0);
ern8=IIf(dy & no==2,trn8 & yrn8 & zrn8,0);
egn7i=IIf(dy & no==2,tgn7i & ygn7i & zgn7i,0);
ern7i=IIf(dy & no==2,trn7i & yrn7i & zrn7i,0);

fgn7=IIf(dy & no==3,tgn7 & ygn7 & zgn7 & agn7,0);
frn7=IIf(dy & no==3,trn7 & yrn7 & zrn7 & arn7,0);
fgn8=IIf(dy & no==3,tgn8 & ygn8 & zgn8 & agn8,0);
frn8=IIf(dy & no==3,trn8 & yrn8 & zrn8 & arn8,0);
fgn7i=IIf(dy & no==3,tgn7i & ygn7i & zgn7i & agn7i,0);
frn7i=IIf(dy & no==3,trn7i & yrn7i & zrn7i & arn7i,0);


ggn7=IIf(dy & no==4,tgn7 & ygn7 & zgn7 & agn7 & bgn7,0);
grn7=IIf(dy & no==4,trn7 & yrn7 & zrn7 & arn7 & brn7,0);
ggn8=IIf(dy & no==4,tgn8 & ygn8 & zgn8 & agn8 & bgn8,0);
grn8=IIf(dy & no==4,trn8 & yrn8 & zrn8 & arn8 & brn8,0);
ggn7i=IIf(dy & no==4,tgn7i & ygn7i & zgn7i & agn7i & bgn7i,0);
grn7i=IIf(dy & no==4,trn7i & yrn7i & zrn7i & arn7i & brn7i,0);

TimeFrameRestore();
red=(since & (C<O | C==O));
green=(since & (C>O | C==O));
Reds=Cum(Red);
Greens=Cum(Green);
redr=IIf(red,O-C,0);
greenr=IIf(green,C-O,0);
Candles=Cum(red + green);
Os=Sum(redr,Candles);
ws=Sum(greenr,Candles);
Lotsize=round((inv*5.5)/r236);
//////////////////////////////////////////////////////////////////
Chg=Ref(C,-1);
if (tchoice==1 ) 
{
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} -   {{INTERVAL}}      {{DATE}}    Open:  %g,    High:  %g,     Low:  %g,     Close:  %g     {{VALUES}}",O, H, L, C, SelectedValue( ROC( C, 1   ) ) ));
}
//////////////////////////////////////////////////////////////////
if (tchoice==2 ) 
{
Title = EncodeColor(colorWhite)+  Date() + "   Tick = " + EncodeColor(5) + Interval()+
EncodeColor(55)+ "   Open:  "+ EncodeColor(colorWhite)+ WriteVal(O,format=1.2) + 
   EncodeColor(55)+ "   High:  "+ EncodeColor(colorWhite) + WriteVal(H,format=1.2) +
   EncodeColor(55)+ "   Low:  "+ EncodeColor(colorWhite)+ WriteVal(L,format=1.2) + 
   EncodeColor(55)+ "   Close:  "+ WriteIf(C> Chg,EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(C,format=1.2)+  
   EncodeColor(55)+ "   Change:  "+ WriteIf(C> Chg,EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(ROC(C,1),format=1.2)+ "%"+               
   EncodeColor(55)+ "   Volume: "+ EncodeColor(colorWhite)+ WriteVal(V,1)+EncodeColor(colorYellow) + "        Lotsize:  "+WriteVal(Lotsize,1)+"        Lotsize/2:  "+WriteVal(Lotsize/2,1)+"\n"+
WriteIf(LastValue(AscT),"Ascending Triangle - bullish formation that usually forms during an uptrend as a continuation pattern"+"","")+
WriteIf(LastValue(DscT),"Decending Triangle - bearish formation that usually forms during a downtrend as a continuation pattern."+"","")+
//WriteIf(LastValue(ST),"Symmetrical Triangle - mark important trend reversals, they more often mark a continuation of the current trend - direction of the next major move can only be determined after a valid breakout."+"","")+
WriteIf(LastValue(ET),"Expanding Triangle - The expanding triangle is said to be a good indicator of a reversal pattern"+"","")+
WriteIf(LastValue(RW),"Rising Wedge - rising wedges definitely slope up and have a bearish bias"+"","")+
WriteIf(LastValue(FW),"Falling Wedge - falling wedges definitely slope down and have a bullish bias."+" ","")+
WriteIf(LastValue(UT),"Up Channel - Bullish Trend"+"","")+
WriteIf(LastValue(DT),"Down Channel - Bearish Trend"+"","")+"\n"+

EncodeColor(colorYellow)+
Comm2=("heikin 5m  :   ")+
WriteIf(LastValue(Condb),EncodeColor(colorBrightGreen)+"+Up",
WriteIf(LastValue(Conds),EncodeColor(colorRed)+"-Down",EncodeColor(colorLightYellow)+"< Flat >"))+"\n"+
EncodeColor(colorYellow)+

Comm2=("heikin 15m  :   ")+
WriteIf(LastValue(Condb1),EncodeColor(colorBrightGreen)+"+Up",
WriteIf(LastValue(Conds1),EncodeColor(colorRed)+"-Down",EncodeColor(colorLightYellow)+"< Flat >"))+"\n"+
EncodeColor(colorYellow)+

Comm2=("heikin 30m  :   ")+
WriteIf(LastValue(Condb2),EncodeColor(colorBrightGreen)+"+Up",
WriteIf(LastValue(Conds2),EncodeColor(colorRed)+"-Down",EncodeColor(colorLightYellow)+"< Flat >"))+"\n"+
EncodeColor(colorYellow)+

Comm2=("heikin 1Hr  :   ")+
WriteIf(LastValue(Condb3),EncodeColor(colorBrightGreen)+"+Up",
WriteIf(LastValue(Conds3),EncodeColor(colorRed)+"-Down",EncodeColor(colorLightYellow)+"< Flat >"))+"\n"+



"\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(V<Vrg AND V>Vn1,EncodeColor(colorRed)+"Less than Average",WriteIf(V<Vn1,EncodeColor(colorRed)+"Low","")))))+ "\n" +
EncodeColor(colorYellow)+

Comm2=("Trend:      ")+
WriteIf(Greens>Reds,EncodeColor(colorBrightGreen)+"+Up",
WriteIf(Reds>Greens,EncodeColor(colorRed)+"-Down",EncodeColor(colorLightYellow)+"< Flat >"))+"\n"+
EncodeColor(colorRed) +
WriteIf(Reds, "Reds:  "+(reds)+"  ","")+"\n"+
EncodeColor(colorBrightGreen) +
WriteIf(Greens, "Greens:  "+(greens)+"  ","")+"\n"+
EncodeColor(colorRed) +
Comm2=("Red Range:  ")+
WriteVal(Os, 1.2)+"\n"+
EncodeColor(colorBrightGreen) +
Comm2=("Green Range:  ")+
WriteVal(Ws, 1.2)+"\n"+
EncodeColor(colorRed) +
WriteIf(ChaikinVolatility( periods )<0, "Chaikin:  "+(ChaikinVolatility( periods )
)+"  ","")+"\n"+
EncodeColor(colorBrightGreen) +
WriteIf(ChaikinVolatility( periods )>0
, "Chaikin:  "+(ChaikinVolatility( periods )
)+"  ","")+
"\n"+
WriteIf(Sup_pricejustabove,EncodeColor(colorBrightGreen)+"Price just above Support",
WriteIf(Sup_confirmed,EncodeColor(colorBrightGreen)+"Support Confirmed",EncodeColor(colorWhite)+""))+
WriteIf(Sup_break,EncodeColor(colorRed)+"Support Break"+"","")+"\n"+
WriteIf(Res_pricejustbelow,EncodeColor(colorRed)+"Price just below Resistance",
WriteIf(Res_confirmed,EncodeColor(colorRed)+"Resistance Confirmed",EncodeColor(colorWhite)+""))+
WriteIf(Res_break,EncodeColor(colorBrightGreen)+"Resistance Break"+"","");
}
GraphXSpace=5;
dy1=IIf(dy==1,(tgn7 | trn7 | tgn8|trn8|tgn7i|trn7i|ygn7 | yrn7 | ygn8|yrn8|ygn7i|yrn7i|zgn7 | zrn7 |zgn8|zrn8|zgn7i|zrn7i|agn7 | arn7 |agn8|arn8|agn7i|arn7i|bgn7 | brn7 | bgn8|brn8|bgn7i|brn7i),0);
dy2=IIf(dy==1,(cgn7 | crn7 | cgn8|crn8|cgn7i|crn7i|dgn7 | drn7 | dgn8|drn8|dgn7i|drn7i|egn7 | ern7 |egn8|ern8|egn7i|ern7i|fgn7 |frn7 |fgn8|frn8|fgn7i|frn7i|ggn7 | grn7 | ggn8|grn8|ggn7i|grn7i),0);

// Angle variables

PI = atan(1.00) * 4; 
periods = periods; 
HighHigh = HHV(H, periods); 
LowLow = LLV(L, periods); 
range = 25 / (HighHigh - LowLow) * LowLow;

// LSMA25 Angle

LSMA25 = OBV(); 
x1_LSMA25 = 0; 
x2_LSMA25 = 1; 
y1_LSMA25 = 0; 
y2_LSMA25 = (Ref(LSMA25, -1) - LSMA25) / Avg * range; 
c_LSMA25 = sqrt((x2_LSMA25 - x1_LSMA25)*(x2_LSMA25 - x1_LSMA25) + (y2_LSMA25 - y1_LSMA25)*(y2_LSMA25 - y1_LSMA25)); 
angle_LSMA25 = round(180 * acos((x2_LSMA25 - x1_LSMA25)/c_LSMA25) / PI); 
angle_LSMA25 = IIf(y2_LSMA25 > 0, - angle_LSMA25, angle_LSMA25); 

Buy=IIf((p00<p100 & ChaikinVolatility( periods )>0 & angle_LSMA25>30 & Ws>=(Os+(Os*perc/100)) & (Cross(H,r236) | Cross(C,r236))),1,0);
Buystop=ValueWhen(Buy,p00);
btgt1=ValueWhen(Buy,r618);
btgt2=ValueWhen(Buy,r786);
Short=IIf((p00>p100  & ChaikinVolatility( periods )>0 & angle_LSMA25<(-30) & Os>=(Ws+(Ws*perc/100)) & (Cross(r236,L) | Cross(r236,C))),1,0);
shortstop=ValueWhen(Short,p00);
stgt1=ValueWhen(Short,r618);
stgt2=ValueWhen(Short,r786);
//Buy=ExRem(Buy,Short);
//Short=ExRem(Short,Buy);

//shapes
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorWhite,0,L,-25 );
PlotShapes(IIf(Short,shapeDownArrow,shapeNone),colorOrange,0,H,-25 );
AddColumn( IIf(Buy & dy==0, r236, IIf(Short & dy==0, r236,01 )), "ENTRY@", 1.2, colorWhite, bkcolor= IIf(Short & dy==0,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy & dy==0, Buystop, IIf(Short & dy==0, Shortstop,01 )), "STOP@", 1.2, colorWhite, bkcolor= IIf(Short & dy==0,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy & dy==0, btgt1, IIf(Short & dy==0, stgt1,01 )), "TARGT-1", 1.2, colorWhite, bkcolor= IIf(Short & dy==0,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy & dy==0, btgt2, IIf(Short & dy==0, stgt2,01 )), "TARGT-2", 1.2, colorWhite, bkcolor= IIf(Short & dy==0,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(Buy & dy==0, Lotsize, IIf(Short & dy==0, Lotsize,01 )), "QNTY", 1, colorWhite, bkcolor= IIf(Short & dy==0,colorDarkRed,colorDarkGreen) );
//AddColumn(dy==1 & no,"NR days",1);
AddColumn( IIf(( dy==1 & tgn7), 55, IIf(( dy==1 & trn7), 55,01 )), "NR7-0", formatChar, colorWhite, bkcolor= IIf((dy==1 & trn7),colorDarkRed,colorDarkGreen) );
AddColumn( IIf((dy==1 & tgn8), 56, IIf(dy==1 & trn8, 56,01 )), "NR8-0", formatChar, colorWhite, bkcolor= IIf(dy==1 & trn8,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & tgn7i, 73, IIf(dy==1 & trn7i, 73,01 )), "NR7i-0", formatChar, colorWhite, bkcolor= IIf(dy==1 & trn7i,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & ygn7, 55, IIf(dy==1 & yrn7, 55,01 )), "NR7-1", formatChar, colorWhite, bkcolor= IIf(dy==1 & yrn7,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & ygn8, 56, IIf(dy==1 & yrn8, 56,01 )), "NR8-1", formatChar, colorWhite, bkcolor= IIf(dy==1 & yrn8,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & ygn7i, 73, IIf(dy==1 & yrn7i, 73,01 )), "NR7i-1", formatChar, colorWhite, bkcolor= IIf(dy==1 & yrn7i,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & zgn7, 55, IIf(dy==1 & zrn7, 55,01 )), "NR7-2", formatChar, colorWhite, bkcolor= IIf(dy==1 & zrn7,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & zgn8, 56, IIf(dy==1 & zrn8, 56,01 )), "NR8-2", formatChar, colorWhite, bkcolor= IIf(dy==1 & zrn8,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & zgn7i, 73, IIf(dy==1 & zrn7i, 73,01 )), "NR7i-2", formatChar, colorWhite, bkcolor= IIf(dy==1 & zrn7i,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & agn7, 55, IIf(dy==1 & arn7, 55,01 )), "NR7-3", formatChar, colorWhite, bkcolor= IIf(dy==1 & arn7,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & agn8, 56, IIf(dy==1 & arn8, 56,01 )), "NR8-3", formatChar, colorWhite, bkcolor= IIf(dy==1 & arn8,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & agn7i, 73, IIf(dy==1 & arn7i, 73,01 )), "NR7i-3", formatChar, colorWhite, bkcolor= IIf(dy==1 & arn7i,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & bgn7, 55, IIf(dy==1 & brn7, 55,01 )), "NR7-4", formatChar, colorWhite, bkcolor= IIf(dy==1 & brn7,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & bgn8, 56, IIf(dy==1 & brn8, 56,01 )), "NR7-4", formatChar, colorWhite, bkcolor= IIf(dy==1 & brn8,colorDarkRed,colorDarkGreen) );
AddColumn( IIf(dy==1 & bgn7i, 66, IIf(dy==1 & brn7i, 83,01 )), "NR7i-4", formatChar, colorWhite, bkcolor= IIf(dy==1 & brn7i,colorDarkRed,colorDarkGreen) );


//daily sup/res

_SECTION_BEGIN("Daily Sup/Res Plot lines");
//Set parameter default to YES for displaying the final
//results of the break out calculations.
PlotBreak =  ParamToggle("Plot Breakout", "YES|NO", 0);
//set parameter default to YES for displaying PP, S1 and R1
PPSR1 = ParamToggle("PP,S1/R1", "YES|NO", 0);
//set paramter default to NO for displaying S2 and R2
S2R2 = ParamToggle("S2,R2", "YES|NO", 0);
//set parameter default to NO for dsiplaying S3 and R3
S3R3 = ParamToggle("S3,R3", "YES|NO", 1);
//set paramter default to NO for diplaying S4 and R4
S4R4 = ParamToggle("S4,R4", "YES|NO", 1);
_SECTION_END();
_SECTION_BEGIN("Realtime Hours ");
//Determine the value of the market close. Initial setting is for
//4:00 PM to match US Market Open. Adjust as need for your market



UserOpen = ParamTime("Market Open", "09:00");
UserClose = ParamTime("Market Close", "15:30");
UseIndia = "YES";//ParamList("Indian Market?", "YES|NO",0);
if(UseIndia == "YES")
{
TimeOpen = ValueWhen(DateNum() != Ref(DateNum(),-1), TimeNum());
}
CalcClose = UserClose;

TimeClose = IIf(StrMid(NumToStr(CalcClose ,1,False),2,2)=="00",
   6000-((Interval()/60)*100)+(CalcClose-10000),
   CalcClose-(100*(Interval()/60)));
CurBarTime = TimeNum();
DlyHigh = HighestSince(CurBarTime  == TimeOpen , High);
DlyHighest = ValueWhen(CurBarTime  == TimeClose , DlyHigh);
DlyLow = LowestSince(CurBarTime  == TimeOpen , Low);
DlyLowest = ValueWhen(CurBarTime  == TimeClose , DlyLow);

MrktClose = ValueWhen(CurBarTime  == TimeClose , Close);
Rangeeee = DlyHighest - DlyLowest;
PP = (DlyHighest + DlyLowest + MrktClose)/3;
PP = round(PP * 4) / 4;
R1 = (2 * PP) - DlyLowest;
S1 = (2 * PP) - DlyHighest;
R2 = PP + Rangeeee;
S2 = PP - Rangeeee;
R3 = R2 + Rangeeee;
S3 = S2 - Rangeeee;
R4 = R3 + Rangeeee;
S4 = S3 - Rangeeee;

TitlePivots = "\n"+
EncodeColor(colorYellow) +"Today's Daily Pivots" +"\n"
    +"R1: " +R1 +"\n" +"PP: " +PP +"\n" +"S1: " +S1 
//+WriteVal((fhh))+WriteVal((FHL))+WriteVal(((TOP)))+ WriteVal((bi1[0]))
+"\n";
if(PPSR1 == 0)
{
Plot(R1, "Dly R1", colorPink, styleDashed | styleThick | styleNoRescale);
Plot(PP, "Dly Pivot", colorGrey40, styleDots | styleThick | styleNoRescale);
Plot(S1, "Dly S1", colorAqua, styleDashed | styleThick | styleNoRescale);
}
if(S2R2 == 0)
{
Plot(R2, "Dly R2", colorPink, styleDashed | styleThick | styleNoRescale);

Plot(S2, "Dly S2",  colorAqua, styleDashed | styleThick | styleNoRescale);

}
if(S3R3 == 0)
{
Plot(R3, "Dly R3", colorPink, styleDashed | styleThick | styleNoRescale);

Plot(S3, "Dly S3",  colorAqua, styleDashed | styleThick | styleNoRescale);

}
if(S4R4 == 0)
{
Plot(R4, "Dly R4", colorPink, styleDashed | styleThick | styleNoRescale);

Plot(S4, "Dly S4",  colorAqua, styleDashed | styleThick | styleNoRescale);

}

_SECTION_END();

Filter=Buy | Short | dy1;
Previous Post Next Post