SetChartBkGradientFill( ParamColor("Inner panel upper",colorDarkGrey),ParamColor("Inner panel lower",colorGrey40 ));
SetChartBkColor(colorBlack);
_SECTION_BEGIN("Price");
SetChartOptions( 2,chartShowArrows+ chartShowDates | chartWrapTitle );
_N(Title = StrFormat("OBV 2nd Method : {{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Layer = Param("Layer", 0, -5, 5, 1) ;
//Plot( C, "Close", colorTeal, styleNoTitle |styleCandle,0,0,0 );
HiVolume = IIf(V > (2 * MA(V,10)), True, False);
PlotShapes(shapeSmallCircle * HiVolume, IIf(C > O, colorRed, colorWhite), 0, (O+C)/2, 0);
ToolTip = "Open = " + O + "\nHigh = " + H + "\nLow = " + L + "\nClose = " + C ;
_SECTION_BEGIN("Price Hi Lo");
y = Param("Ribbon price location",15,0,500,5);
HiP= HHV(H,15); LoP= LLV(L,15);
B2 = Cross(C,Ref(HiP,-1)); S2 = Cross(Ref(LoP,-1),C);
B2 = ExRem(B2,S2); S2 = ExRem(S2,B2);
UP2 = Flip(B2,S2); DN2 = Flip(S2,B2);
//Plot(12,"p",IIf(UP2,colorGreen,colorOrange),styleOwnScale|styleNoLabel|styleThick,0,200,0,-5,8);
PlotOHLC(y,Y+10,y,y,"",IIf(UP2,colorGreen,colorOrange),styleOwnScale|styleNoLabel|styleCloud,0,500);
//Plot(IIf(b2,1,0),"",colorBlue,styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1);
//Plot(IIf(s2,1,0),"",colorRed, styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1);
_SECTION_END();
_SECTION_BEGIN("OBV Hi Lo");
y = Param("Ribbon obv location",5,0,500,5);
periods = Param("OBV hiLo periods",15,0,100);
Ob = OBV(); Hi = HHV(Ob,periods); Lo = LLV(Ob,periods);
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);
//Plot(10,"",IIf(UP1,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleThick,0,500,0,-5,8);
PlotOHLC(y,Y+10,y,y,"",IIf(UP1,colorBlue,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),"",colorBlue,styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1);
Plot(IIf(S1,1,0),"",colorRed, styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1); //vertical lines
}
_SECTION_BEGIN("Alerts");
bluetored = s1;
redtoblue = b1;
RequestTimedRefresh(20);
AlertIf(redtoblue,"SOUND C:\\Windows\\Media\\Ding.wav", "buy"+Name(),1,1+2+4);
AlertIf(bluetored,"SOUND C:\\Windows\\Media\\Ding.wav", "Sell"+Name(),2,1+2+4);
_SECTION_END();
_SECTION_BEGIN("OBV hi/lo and Supp/Res");
ro = ParamField("Open", 0) ;
rh = ParamField("High", 1) ;
rl = ParamField("Low", 2) ;
rc = ParamField("Close", 3) ;
P = (rH+rL+rC)/3 ;
// = Param("Fast", 1, 1, 100, 1) ;
// = Param("Slow", 3, 1, 100, 1) ;
isemapvts = ParamToggle("Want Pivots ", "No|Yes", 1) ;
pvttype = ParamToggle("Pvt type", "Price|Obv",1);
periodtype = ParamToggle("15 period or 60 period lines?","60 period|15 period",1);
ismph = H-H ;
ismpl = L-L ;
if (isemapvts)
{
if(pvttype)
{
if(periodtype)
{
upcross = b1 ; // 15 obv
downcross = s1 ;
}
else
{
upcross = b60; //60obv
downcross = s60;
}
}
else
{
upcross = b2; // price
downcross = s2;
}
bi = BarIndex() ;
mphbar = HighestSinceBars(upcross, rH) ;
mplbar = LowestSinceBars(downcross, rL) ;
mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;
mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;
ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;
}
_SECTION_BEGIN("OBV Sup/res lines Plot");
showobvSupResline = ParamToggle("Show Obv Sup/Res line", "No|Yes", 1) ;
if (showobvSupResline)
{
//Ch = Param("ch", 5,1,15,1);
bi = Cum(1)-1;
cbar = Param("cbar",2,2,50,1);
P1 = ismph;//GetTop(Ch);
V1 = ismpl;//GetValley(Ch);
P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) < ValueWhen(V1,bi),P1,IIf(ValueWhen(P1,H,2) > H,False,P1)),P1);
P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) < ValueWhen(V1,bi,0),IIf(ValueWhen(P1,H,0) >= H,False,P1),P1),P1);
V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) < ValueWhen(P1,bi),V1,IIf(ValueWhen(V1,L,2)<L,False, V1)),V1);
V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi ,IIf(ValueWhen(V1,bi,0) < ValueWhen(P1,bi,0),IIf(ValueWhen(V1,L,0) <= L, False,V1),V1),V1);
RF=ValueWhen(P1,H);
SF=ValueWhen(V1,L);
RF1 = IIf(RF AND BarsSince(P1) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(V1) <=cbar,SF,Null);
Plot(RF1,"",colorBlue,styleDots | styleNoLine|styleNoRescale);
Plot(SF1,"",colorBlue,styleDots | styleNoLine|styleNoRescale);
Plot(RF,"",ParamColor("Resistance",colorRed),40+16+2048);//2048 is stylenorescale
Plot(SF,"",ParamColor("Support",colorGreen),40+16+2048);
PlotShapes(IIf(P1, shapeSmallSquare,shapeNone),colorGreen,0,H,10);
PlotShapes(shapeSmallCircle*P1,colorBlack,0,H,10);
PlotShapes(IIf(V1, shapeSmallSquare,shapeNone),colorGreen,0,L,-10);
PlotShapes(shapeSmallCircle*V1,colorCustom12,0,L,-10);
}
_SECTION_END();
_SECTION_BEGIN("EMA1");
P = C;
Periods = Param("Periods", 200, 2, 300, 1, 0 );
EMA1 = EMA(P,Periods);
Plot( eMA1, _DEFAULT_NAME(), ParamColor( "Color", colorPink ), ParamStyle("Style",styleDashed|styleNoRescale) );
//I want OBV line(white) as green when its above 200 ema
//AND Red when its below 200 EMA .
SetChartOptions( 2,chartShowArrows+ chartShowDates | chartWrapTitle );
GraphXSpace=10;
_SECTION_BEGIN("On Balance Volume");
Ob = OBV(); e36 = EMA(Ob,36); e200 = EMA(Ob,200);
Color = IIf(ob>e200,colorGreen,colorRed);
Plot(Ob,"ob",color,styleThick);
Plot(0,"",colorWhite,styleNoLabel|styleNoRescale|styleDashed,0,0,5,-5);
//Plot(e200,"",colorBrightGreen,styleNoLabel|styleNoRescale);
//Plot(e36, "",colorGold,styleNoLabel|styleNoRescale|styleDashed);
_SECTION_END();
ND = Day()!=Ref(Day(),-1);
LB = Day()!=Ref(Day(),1);
Ob = OBV();
Zero = ValueWhen(LB,Ob);
Plot(Zero,"",colorWhite,styleNoLabel|styleNoRescale|styleStaircase|styleDashed);
SetChartBkGradientFill( ParamColor("Inner panel upper",colorDarkGrey),ParamColor("Inner panel lower",colorGrey40 ));
SetChartBkColor(colorBlack);
_SECTION_BEGIN("Price");
SetChartOptions( 2,chartShowArrows+ chartShowDates | chartWrapTitle );
_N(Title = StrFormat("OBV 2nd Method : {{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Layer = Param("Layer", 0, -5, 5, 1) ;
//Plot( C, "Close", colorTeal, styleNoTitle |styleCandle,0,0,0 );
HiVolume = IIf(V > (2 * MA(V,10)), True, False);
PlotShapes(shapeSmallCircle * HiVolume, IIf(C > O, colorRed, colorWhite), 0, (O+C)/2, 0);
ToolTip = "Open = " + O + "\nHigh = " + H + "\nLow = " + L + "\nClose = " + C ;
_SECTION_BEGIN("Price Hi Lo");
y = Param("Ribbon price location",15,0,500,5);
HiP= HHV(H,15); LoP= LLV(L,15);
B2 = Cross(C,Ref(HiP,-1)); S2 = Cross(Ref(LoP,-1),C);
B2 = ExRem(B2,S2); S2 = ExRem(S2,B2);
UP2 = Flip(B2,S2); DN2 = Flip(S2,B2);
//Plot(12,"p",IIf(UP2,colorGreen,colorOrange),styleOwnScale|styleNoLabel|styleThick,0,200,0,-5,8);
PlotOHLC(y,Y+10,y,y,"",IIf(UP2,colorGreen,colorOrange),styleOwnScale|styleNoLabel|styleCloud,0,500);
//Plot(IIf(b2,1,0),"",colorBlue,styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1);
//Plot(IIf(s2,1,0),"",colorRed, styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1);
_SECTION_END();
_SECTION_BEGIN("OBV Hi Lo");
y = Param("Ribbon obv location",5,0,500,5);
periods = Param("OBV hiLo periods",15,0,100);
Ob = OBV(); Hi = HHV(Ob,periods); Lo = LLV(Ob,periods);
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);
//Plot(10,"",IIf(UP1,colorBlue,colorRed),styleOwnScale|styleNoLabel|styleThick,0,500,0,-5,8);
PlotOHLC(y,Y+10,y,y,"",IIf(UP1,colorBlue,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),"",colorBlue,styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1);
Plot(IIf(S1,1,0),"",colorRed, styleOwnScale|styleNoLabel|styleHistogram|styleDashed,0,1); //vertical lines
}
_SECTION_BEGIN("Alerts");
bluetored = s1;
redtoblue = b1;
RequestTimedRefresh(20);
AlertIf(redtoblue,"SOUND C:\\Windows\\Media\\Ding.wav", "buy"+Name(),1,1+2+4);
AlertIf(bluetored,"SOUND C:\\Windows\\Media\\Ding.wav", "Sell"+Name(),2,1+2+4);
_SECTION_END();
_SECTION_BEGIN("OBV hi/lo and Supp/Res");
ro = ParamField("Open", 0) ;
rh = ParamField("High", 1) ;
rl = ParamField("Low", 2) ;
rc = ParamField("Close", 3) ;
P = (rH+rL+rC)/3 ;
// = Param("Fast", 1, 1, 100, 1) ;
// = Param("Slow", 3, 1, 100, 1) ;
isemapvts = ParamToggle("Want Pivots ", "No|Yes", 1) ;
pvttype = ParamToggle("Pvt type", "Price|Obv",1);
periodtype = ParamToggle("15 period or 60 period lines?","60 period|15 period",1);
ismph = H-H ;
ismpl = L-L ;
if (isemapvts)
{
if(pvttype)
{
if(periodtype)
{
upcross = b1 ; // 15 obv
downcross = s1 ;
}
else
{
upcross = b60; //60obv
downcross = s60;
}
}
else
{
upcross = b2; // price
downcross = s2;
}
bi = BarIndex() ;
mphbar = HighestSinceBars(upcross, rH) ;
mplbar = LowestSinceBars(downcross, rL) ;
mphbi = ValueWhen(downcross, bi, 0) - ValueWhen(downcross, mphbar, 0) ;
ismph = mphbi == bi ;
mplbi = ValueWhen(upCross, bi, 0) - ValueWhen(upCross, mplbar, 0) ;
ismpl = mplbi == bi ;
ismph = IIf(downCross AND mphbar == 0, True, ismph) ;
ismpl = IIf(upcross AND mplbar == 0, True, ismpl) ;
}
_SECTION_BEGIN("OBV Sup/res lines Plot");
showobvSupResline = ParamToggle("Show Obv Sup/Res line", "No|Yes", 1) ;
if (showobvSupResline)
{
//Ch = Param("ch", 5,1,15,1);
bi = Cum(1)-1;
cbar = Param("cbar",2,2,50,1);
P1 = ismph;//GetTop(Ch);
V1 = ismpl;//GetValley(Ch);
P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) < ValueWhen(V1,bi),P1,IIf(ValueWhen(P1,H,2) > H,False,P1)),P1);
P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) < ValueWhen(V1,bi,0),IIf(ValueWhen(P1,H,0) >= H,False,P1),P1),P1);
V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) < ValueWhen(P1,bi),V1,IIf(ValueWhen(V1,L,2)<L,False, V1)),V1);
V1 = IIf(V1 AND ValueWhen(V1,bi,0) > bi ,IIf(ValueWhen(V1,bi,0) < ValueWhen(P1,bi,0),IIf(ValueWhen(V1,L,0) <= L, False,V1),V1),V1);
RF=ValueWhen(P1,H);
SF=ValueWhen(V1,L);
RF1 = IIf(RF AND BarsSince(P1) <=cbar,RF,Null);
SF1 = IIf(SF AND BarsSince(V1) <=cbar,SF,Null);
Plot(RF1,"",colorBlue,styleDots | styleNoLine|styleNoRescale);
Plot(SF1,"",colorBlue,styleDots | styleNoLine|styleNoRescale);
Plot(RF,"",ParamColor("Resistance",colorRed),40+16+2048);//2048 is stylenorescale
Plot(SF,"",ParamColor("Support",colorGreen),40+16+2048);
PlotShapes(IIf(P1, shapeSmallSquare,shapeNone),colorGreen,0,H,10);
PlotShapes(shapeSmallCircle*P1,colorBlack,0,H,10);
PlotShapes(IIf(V1, shapeSmallSquare,shapeNone),colorGreen,0,L,-10);
PlotShapes(shapeSmallCircle*V1,colorCustom12,0,L,-10);
}
_SECTION_END();
_SECTION_BEGIN("EMA1");
P = C;
Periods = Param("Periods", 200, 2, 300, 1, 0 );
EMA1 = EMA(P,Periods);
Plot( eMA1, _DEFAULT_NAME(), ParamColor( "Color", colorPink ), ParamStyle("Style",styleDashed|styleNoRescale) );
//I want OBV line(white) as green when its above 200 ema
//AND Red when its below 200 EMA .
SetChartOptions( 2,chartShowArrows+ chartShowDates | chartWrapTitle );
GraphXSpace=10;
_SECTION_BEGIN("On Balance Volume");
Ob = OBV(); e36 = EMA(Ob,36); e200 = EMA(Ob,200);
Color = IIf(ob>e200,colorGreen,colorRed);
Plot(Ob,"ob",color,styleThick);
Plot(0,"",colorWhite,styleNoLabel|styleNoRescale|styleDashed,0,0,5,-5);
//Plot(e200,"",colorBrightGreen,styleNoLabel|styleNoRescale);
//Plot(e36, "",colorGold,styleNoLabel|styleNoRescale|styleDashed);
_SECTION_END();
ND = Day()!=Ref(Day(),-1);
LB = Day()!=Ref(Day(),1);
Ob = OBV();
Zero = ValueWhen(LB,Ob);
Plot(Zero,"",colorWhite,styleNoLabel|styleNoRescale|styleStaircase|styleDashed);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
O | Should we ignore loss in Forex Trading? | Forex | 2 | |
O | Fundmentals Of Forex Trading Strategies | Forex | 0 | |
O | The reality of Forex Trading Business. | Forex | 2 | |
R | Forex trading, where do customers go? | General Trading & Investing Chat | 1 | |
R | Importance of demo trading | General Trading & Investing Chat | 1 |