in Search

KPL Swing Indicator

Last post 08-25-2012, 0:19 by mt4eas. 3 replies.
Sort Posts: Previous Next
  •  06-11-2012, 0:34 38627

    Paradise [ip] KPL Swing Indicator

    KPL Swing Indicator for Metastock

    no:=Input("Swing/ Bars",1, 20, 2);
    res:=HHV(H,no);
    sup:=LLV(L,no);
    HLd:=If(CLOSE>Ref(res,-1),
    {then}1,
    {else}If(CLOSE<ref(sup,-1),
    {then}-1,
    {else}0));
    HLv:=ValueWhen(1,HLd<>0,HLd);
    HiLo:=If(HLv=-1,
    {then}res,
    {else}sup);
    HiLo;

    The above is the Swing indicator which is plotted directly on Metastock chart

    Originally the indicator is plotted in one color.

    I want a code to change the indicator color to Red when the Close is below the indicator and again the color should change to Blue when stock trades above the Close.

    Please can any help me with the required code which changes color as per the requirement.
  •  06-11-2012, 15:18 38628 in reply to 38627

    Re: KPL Swing Indicator

    Hi Kshetij

    Can you repost the code using the appropriate tags to prevent the code from being corrupted? Any recent post by Wabbit includes information on how to do that.

    Is the indicator to be plotted as a histogram or a line? Histograms are easy to colour, but lines range from difficult to impossible depending on the style.

    Roy

  •  06-11-2012, 16:29 38629 in reply to 38628

    Re: KPL Swing Indicator

    this is the code in amibroker

    Code:

    /* my entry is very simple(daily data for trading)
     
    kpl system for entry only & exit as follow:
     
    1 st exit at x % from entry price only 1/3 quantity.(ie 1st profit target)
    2 nd exit when exit Signal comes from kpl sys remaining 1/3 quantity.
    3. scale-in to initial quantity if new kpl Buy Signal comes.
    re-do above scaling-out & scaling-in till filal exit.
    4. final exit all quantity when Close below 21 Day EMA.
     
    kpl system code bellow :
    */
    //AFL by Kamalesh Langote. Email:kpl@...
    no=Param( "Swing", 2, 1, 55 );
    tsl_col=ParamColor( "Color", colorCycle );
     
    res=HHV(H,no);
    sup=LLV(L,no);
    avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
    avn=ValueWhen(avd!=0,avd,1);
    tsl=IIf(avn==1,sup,res);
    Buy=Cross(C,tsl) ;
    Sell= Cross(tsl,C) ;
     
    Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase);
    shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
    PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
    SetPositionSize(300,spsShares);
    ApplyStop(0,1,10,1);



  •  08-25-2012, 0:19 39115 in reply to 38627

    Re: KPL Swing Indicator

    This is Ravi_swing indicator and posted by me in Traderji. It is not KPL Swing. If you would have asked me then i will help. Sorry friend.
View as RSS news feed in XML