//===========================================================================================================================
GraphXSpace=5;
_SECTION_BEGIN("On Balance Volume");
Ob = OBV(); e36 = EMA(Ob,36); e200 = EMA(Ob,200);
Plot(Ob,"",IIf(e36<Ob,colorBlue,colorRed),styleNoTitle|styleThick);
Plot(0,"",colorWhite,styleNoLabel|styleNoRescale|styleDashed,0,0,5,-5);
Plot(e200,"",colorBrightGreen,styleNoLabel|styleNoRescale);
Plot(e36, "",colorGold,styleNoLabel|styleNoRescale|styleDashed);
_SECTION_END();
_SECTION_BEGIN("OBV HOURLY Hi-Lo");
n = Param("Periods", 60, 15, 300, 15 );
Ob = OBV();
ObHHi = HHV(Ob,n); ObHLo = LLV(Ob,n);
Plot(ObHHi,"",colorLime,styleNoLabel|styleNoRescale,0,0,2);
Plot(ObHLo,"",colorLime,styleNoLabel|styleNoRescale,0,0,2);
_SECTION_END();
_SECTION_BEGIN("OBV ID Zero Level");
ND = Day()!=Ref(Day(),-1); LB = Ref(ND,-1);
Ob = OBV(); Zero = ValueWhen(LB,Ob);
Plot(Zero,"",colorRed,styleNoLabel|styleNoRescale|styleStaircase|styleDashed,0,0,0,-5);
_SECTION_END();
_SECTION_BEGIN("OBV & Price Hi Lo Breaks");
Ob = OBV();
H15 = HHV(Ob,15); L15 = LLV(Ob,15); B1 = Cross(Ob,Ref(H15,-1)); S1 = Cross(Ref(L15,-1),Ob);
H30 = HHV(Ob,30); L30 = LLV(Ob,30); B2 = Cross(Ob,Ref(H30,-1)); S2 = Cross(Ref(L30,-1),Ob);
H60 = HHV(Ob,60); L60 = LLV(Ob,60); B3 = Cross(Ob,Ref(H60,-1)); S3 = Cross(Ref(L60,-1),Ob);
B1 = ExRem(B1,S1); S1 = ExRem(S1,B1); UP1 = Flip(B1,S1); DN1 = Flip(S1,B1);
B2 = ExRem(B2,S2); S2 = ExRem(S2,B2); UP2 = Flip(B2,S2); DN2 = Flip(S2,B2);
B3 = ExRem(B3,S3); S3 = ExRem(S3,B3); UP3 = Flip(B3,S3); DN3 = Flip(S3,B3);
P15 = HHV(H,15); Q15 = LLV(L,15); X1 = Cross(C,Ref(P15,-1)); Y1 = Cross(Ref(Q15,-1),C);
P30 = HHV(H,30); Q30 = LLV(L,30); X2 = Cross(C,Ref(P30,-1)); Y2 = Cross(Ref(Q30,-1),C);
P60 = HHV(H,60); Q60 = LLV(L,60); X3 = Cross(C,Ref(P60,-1)); Y3 = Cross(Ref(Q60,-1),C);
X1 = ExRem(X1,Y1); Y1 = ExRem(Y1,X1); LG1 = Flip(X1,Y1); SH1 = Flip(Y1,X1);
X2 = ExRem(X2,Y2); Y2 = ExRem(Y2,X2); LG2 = Flip(X2,Y2); SH2 = Flip(Y2,X2);
X3 = ExRem(X3,Y3); Y3 = ExRem(Y3,X3); LG3 = Flip(X3,Y3); SH3 = Flip(Y3,X3);
B15 = UP1 AND LG1; S15 = DN1 AND SH1;
B30 = UP2 AND LG2; S30 = DN2 AND SH2;
B60 = UP3 AND LG3; S60 = DN3 AND SH3;
B15 = ExRem(B15,S15); S15 = ExRem(S15,B15); UP15 = Flip(B15,S15); DN15 = Flip(S15,B15);
B30 = ExRem(B30,S30); S30 = ExRem(S30,B30); UP30 = Flip(B30,S30); DN30 = Flip(S30,B30);
B60 = ExRem(B60,S60); S60 = ExRem(S60,B60); UP60 = Flip(B60,S60); DN60 = Flip(S60,B60);
Plot(30,"",IIf(UP1,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleThick,0,250,0,0,3);
Plot(20,"",IIf(UP2,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleThick,0,250,0,0,3);
Plot(10,"",IIf(UP3,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleThick,0,250,0,0,3);
Title = "Varun's OBV & Price Breakout Ribbons, Topmost: 15 Minutes, Lowest: 60 Minutes & Middle 30 Minutes";
_SECTION_END();
_SECTION_BEGIN("OBV ID Zero Line");
ND = Day()!=Ref(Day(),-1); LB = Ref(ND,-1); // LB: Last Bar of the day
Ob = OBV(); Zero = ValueWhen(LB,Ob);
Plot(Zero,"",colorWhite,styleNoLabel|styleNoRescale|styleStaircase|styleDashed,0,0,0,-5);
_SECTION_END();
Ob = OBV(); T = TimeNum();
T1 = 110000; T2 = 130000;
Funds = ValueWhen(T==T1,Ob);
Plot(IIf(T>=T1,Funds,Null),"",colorLightGrey,styleNoLabel|styleNoRescale|styleStaircase|styleDashed,0,0,0,-5);
Plot(IIf(T==T1,1,Null),"",colorLightGrey,styleNoLabel|styleOwnScale|styleHistogram|styleDashed,0,1,0,-5);
Europe = ValueWhen(T==T2,Ob);
Plot(IIf(T>=T2,Europe,Null),"",colorYellow,styleNoLabel|styleNoRescale|styleStaircase|styleDashed,0,0,0,-5);
Plot(IIf(T==T2,1,Null),"",colorYellow,styleNoLabel|styleOwnScale|styleHistogram|styleDashed,0,1,0,-5);
//===========================================================================================================================
/*