Sir,
all credit goes to Happy Ji and Extermist Ji, I just tinkered around, coding is not my cup of tea :lol:
all credit goes to Happy Ji and Extermist Ji, I just tinkered around, coding is not my cup of tea :lol:
Code:
SetChartOptions(0,chartShowArrows|chartShowDates);
Ob = OBV();
//Plot(Ob,"",colorWhite,styleNoTitle|styleThick,0,0,0,0,2);
n=Day() != Ref(Day(), -1);
a=LowestSince(n,V);
ll=ValueWhen(V==a,OBV());
Obcolor=IIf(Ob>EMA(OBV(),36)AND OBV()>ll,colorGreen,colorRed);
Plot(Ob,"Ob",Obcolor,styleThick,0,0,0,0,2);
_SECTION_BEGIN("Sessions");
Sessions=ParamToggle("Sessions","Off|On",1);
if(Sessions)
{
Ob = OBV();
LB = Day()!=Ref(Day(),1);
Zero = ValueWhen(LB,Ob);
T = TimeNum();
T1 = T >= 105900 AND T <=110000;
T2 = T >= 125900 AND T <=130000;
T3 = T >= 142900 AND T <=143000;
Sessions = IIf(T>=142959, ValueWhen(T3,Ob), IIf(T>=125959, ValueWhen(T2,Ob), IIf(T>=105959, ValueWhen(T1,Ob), Zero)));
Plot(Sessions,"",ColorRGB(255,0,255),styleNoLabel|styleNoRescale|styleStaircase|styleLine,0,0,-1,-1);
}
_SECTION_END();
_SECTION_BEGIN("PDC");
PDC=ParamToggle("PDC","Off|On",1);
if(PDC)
{
ND = Day()!=Ref(Day(),-1);
LB = Day()!=Ref(Day(),1);
Ob = OBV();
Zero = ValueWhen(LB,Ob);
Plot(Zero,"",colorRed,styleNoLabel|styleNoRescale|styleStaircase|styleDots,0,0,-2,-1);
}
_SECTION_END();
_SECTION_BEGIN("VKBand");
VKBand=ParamToggle("VKBand","Off|On",1);
if(VKBand)
{
Periods = Param("Periods", 20, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
bTop=BBandTop( OBV(), periods, width );
bBottom=BBandBot( OBV(), periods, width );
eh=EMA(btop,2);
el = EMA(bbottom,2);
kt = MA(eh,8)+(0.4*ATR(8));
kb = MA(el,8)-(0.4*ATR(8));
vt = TEMA(kt,2);
vb = TEMA(kb,2);
Plot(vt,"\nVtop",colorAqua,styleThick);
Plot(vb,"\nVbot",colorPink,styleThick);
}
_SECTION_END();
_SECTION_BEGIN("OBVRibbon");
OBVRibbon=ParamToggle("OBVRibbon","Off|On",1);
if(OBVRibbon)
{
y = Param("Ribbon Y",5,0,500,5);
Ob = OBV(); Hi = HHV(Ob,15); Lo = LLV(Ob,15);
B1 = Cross(Ob,Ref(Hi,-1)); S1 = Cross(Ref(Lo,-1),Ob);
B1 = ExRem(B1,S1); S1 = ExRem(S1,B1);
UP1 = Flip(B1,S1); DN1 = Flip(S1,B1);
e3 = EMA(Ob,3); e200 = EMA(Ob,200); e36 = EMA(Ob,36);
nd = Day()!=Ref(Day(),-1);
lb = Day()!=Ref(Day(),1);
ob = OBV();
zero = ValueWhen(lb,ob);
//Plot(Ob,"",colorWhite,styleNoTitle|styleThick,0,0,0,0,2);
Plot(10,"",IIf(UP1,colorBrightGreen,colorRed),styleOwnScale|styleNoLabel|styleThick,0,500,0,-5,8);
PlotOHLC(y,Y+10,y,y,"",IIf(UP1,colorBrightGreen,colorRed),styleOwnScale|styleNoLabel|styleCloud,0,500);
showVerticalObvlines15 = ParamToggle("Show vertical line for 15 ribbon change", "No|Yes", 0) ;
if (showVerticalObvlines15)
{
Plot(IIf(B1,1,0),"",colorBrightGreen,styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1);
Plot(IIf(S1,1,0),"",colorRed, styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1); //vertical lines
}
}
_SECTION_END();
_SECTION_BEGIN("OBVHOURLYHiLo");
OBVHOURLYHiLo=ParamToggle("OBVHOURLYHiLo","Off|On",1);
if(OBVHOURLYHiLo)
{
n = Param("Periods", 60, 15, 300, 15 );
Ob = OBV();
re = HHV(Ob,n); su = LLV(Ob,n);
Plot(re,"",colorOrange,styleNoLabel|styleNoRescale,0,0,2);
Plot(su,"",colorBrightGreen,styleNoLabel|styleNoRescale,0,0,2);
//PlotOHLC(ObHLo,ObHLo,ObHLo,ObHLo,"Cloud",ColorRGB(64,64,64),styleCloud|styleNoRescale,Null,Null,0,-3,0);
//PlotOHLC( re, re, su, su, "",ColorRGB(64,64,64),styleNoRescale|styleNoLabel|styleCloud,0,-3,1);
}
_SECTION_END();
_SECTION_BEGIN("EM");
EM=ParamToggle("EM","Off|On",1);
if(EM)
{
Ob = OBV();
Plot(Ob,"",colorWhite,styleNoTitle|styleThick,0,0,0,0,2);
Plot( EMA( OBV(), 36 ), "EMA36OBV", colorYellow, styleDashed ,styleNoLabel|styleNoRescale );
Plot( EMA( OBV(), 200 ), "EMA200OBV", colorAqua, styleLine ,styleNoLabel|styleNoRescale );
m3=EMA(OBV(),36);
m4=EMA(OBV(),200);
//PlotOHLC(m3,m3,m4,m4,"Cloud",ColorRGB(64,64,64),styleCloud|styleNoRescale,Null,Null,0,-2,0);
}
_SECTION_END();
_SECTION_BEGIN("LVBar");
LVBar=ParamToggle("LVBar","Off|On",1);
if(LVBar)
{
n=Day() != Ref(Day(), -1);
a=LowestSince(n,V);
hh=ValueWhen(V==a,OBV());
ll=ValueWhen(V==a,OBV());
Plot(hh,"\nLVhb",colorGreen,styleDots);
//Plot(ll,"\nLVlb",colorred,styleDots);
}
_SECTION_END();
HI MB
In this code, OBV changes color in respect of 36 EMA or respect to LV bar?
thanks