Trading with OBV - for Beginners only !!

Discussion in 'Beginners Guide' started by vijkris, Mar 14, 2017.

  1. vijkris

    vijkris Well-Known Member

    Joined:
    Mar 4, 2013
    Messages:
    3,719
    Likes Received:
    7,954
    Trophy Points:
    113
    Location:
    hyderabad
    Hi,
    First would like to thank Varun ji for coming in this forum and sharing his immense knowledge and trading ideas in this sticky thread.

    Also would like to thank Happy ji for creating the relevant afls.
    :thanx:


    Purpose of this thread :
    1. To help beginners in trading to use a simple and effective trading method.

    2. To compile all the required rules and afls in the 1st page of the thread, so that one need not search it in the original thread.

    3. A dedicated place for slow learners, without disturbing the professionals who are currently discussing in the original thread.




    Please consider the posts in this thread as notes taken by students. :thumb:
     
  2. vijkris

    vijkris Well-Known Member

    Joined:
    Mar 4, 2013
    Messages:
    3,719
    Likes Received:
    7,954
    Trophy Points:
    113
    Location:
    hyderabad
    First Method:

    Use of 200ema in Obv and Price :

    Long Summary of the 1st method:


    Long signal in crude..

    [​IMG]

    [​IMG]

    Code:
    SetChartOptions( 2,chartShowArrows+ chartShowDates |   chartWrapTitle );
    Title = "OBV 1st method: 200 ema";
    
    GraphXSpace=5;
    _SECTION_BEGIN("On Balance Volume");
    Ob = OBV();	e36 = EMA(Ob,36);	e200 = EMA(Ob,200); e3 = EMA(Ob,3);
    Plot(Ob,"",colorWhite,styleNoTitle|styleThick);
    Plot(0,"",colorWhite,styleNoLabel|styleNoRescale|styleDashed,0,0,5,-5);
    Plot(e200,"",colorBrightGreen,styleNoLabel|styleNoRescale);
    Plot(e36, "",colorGold,styleNoLabel|styleNoRescale|styleDashed);
    Plot(e3, "",colorViolet,styleNoLabel|styleNoRescale|styleDashed);
    _SECTION_END();
    
    //Buy = Cross(OBV(),e200);
    Buy = Cross(e3,e200);
    //Sell = Cross(e200,OBV());
    Sell = Cross(e200,e3);
    
    PlotShapes(Buy*shapeUpArrow,colorGreen,0,e200,-20);
    PlotShapes(Sell*shapeDownArrow,colorRed,0,e200,-20);
    
    //Buy1 = Cross(OBV(),E36) AND E36>E200;
    //Sell1 = Cross(E36,OBV())AND E36<E200;
    Buy1 = Cross(e3,E36) AND E36>E200;
    Sell1 = Cross(E36,e3)AND E36<E200;
    
    PlotShapes(Buy1*shapeUpArrow,colorBlue,0,E36,-20);
    PlotShapes(Sell1*shapeDownArrow,colorBlue,0,E36,-20);
    
    _SECTION_BEGIN("alerts");
    RequestTimedRefresh(20);
    AlertIf(Buy,"SOUND C:\\Windows\\Media\\Ding.wav", "buy"+Name(),1,1+2+4); 
    AlertIf(Sell,"SOUND C:\\Windows\\Media\\Ding.wav", "Sell"+Name(),2,1+2+4);
    //AlertIf(Buy1,"SOUND C:\\Windows\\Media\\Ding.wav", "B Reentry"+Name(),4,1+2+4);
    //AlertIf(Sell1,"SOUND C:\\Windows\\Media\\Ding.wav", "S Reentry"+Name(),3,1+2+4);
    _SECTION_END();  
    
    
     
  3. varunkochhar

    varunkochhar Well-Known Member

    Joined:
    Jul 12, 2009
    Messages:
    5,917
    Likes Received:
    14,416
    Trophy Points:
    113
    Vijkris ji welcome back. I was missing you.
     
  4. vijkris

    vijkris Well-Known Member

    Joined:
    Mar 4, 2013
    Messages:
    3,719
    Likes Received:
    7,954
    Trophy Points:
    113
    Location:
    hyderabad
    Another frequently asked Question:

    How to set up OBV in Kite/Pi ?


    Thanks to Tuna ji for the explanation and Yachusai ji for digging up the link for this info. :thumb:

     
  5. vagar11

    vagar11 Well-Known Member

    Joined:
    Jun 5, 2013
    Messages:
    1,072
    Likes Received:
    1,701
    Trophy Points:
    113
    Location:
    Hyderabad
    Thanks for starting a new thread. Missed all the action in the other thread. It went too fast. Hoping to learn obv here.
     
    yachusai and vijkris like this.
  6. yachusai

    yachusai Active Member

    Joined:
    Jul 28, 2014
    Messages:
    156
    Likes Received:
    241
    Trophy Points:
    43
    Nice start Bro , i wish this thread achieve its purpose . i want to say more but my language barrier restrict me . i hope english teacher start seperate thread for me :lol:
     
    vijkris likes this.

  7. vijkris

    vijkris Well-Known Member

    Joined:
    Mar 4, 2013
    Messages:
    3,719
    Likes Received:
    7,954
    Trophy Points:
    113
    Location:
    hyderabad
    Second Method of trading with obv:

    This method is applicable only for amibroker users or for someone who is intelligent enough to identify Bo/Bd in Obv chart visually.

    For normal people like us, Amibroker will do the job of identifying bo/bd and we can trade in a relaxed way.

    Please don't drag and drop these afls.. Instead save it in afl editor, and use insert chart/double click and insert it in a new sheet.

    Code:
    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 Y",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 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); 
    
    //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) ); 
    
    
    
    The above code is in the price pane and the 1st method's code in the bottom pane.

    [​IMG]

    Simple explanation by Happyji:

     
  8. aja

    aja Well-Known Member

    Joined:
    Nov 19, 2015
    Messages:
    740
    Likes Received:
    856
    Trophy Points:
    93
    Big Thanks for opening this thread for a slow learner,bulb version 0.5Watts like me :D
     
  9. Subhadip

    Subhadip Well-Known Member

    Joined:
    Apr 2, 2010
    Messages:
    2,977
    Likes Received:
    7,587
    Trophy Points:
    113
    Location:
    in-ter-net
    Great work.....nice new points for me..

    Thanks a lot...
     
    vijkris likes this.
  10. SevenD

    SevenD Well-Known Member

    Joined:
    Jun 20, 2014
    Messages:
    180
    Likes Received:
    321
    Trophy Points:
    63
    Excellent Vijkris,

    You've hardly come from your holidays and you've already started the thread to give your take on the OBV method.

    Excellent commitment :thumb:
     
    masterjee, kumudhan and vijkris like this.
Loading...

Share This Page