logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
MS Support  
#1 Posted : Wednesday, August 22, 2012 4:34:50 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)

Johnny Dough’s article, “Reversing MACD” describes how to make to all-in-one indicators for AmiBroker and how to use them.

  1. Tools menu, select New to open the Indicator Editor for a new indicator.
  2. t1:= Input("fast periods", 5, 24, 12);

    t2:= Input("slow periods", 10, 52, 26);

    pick:= Input("plot: <1=MACDeq 2=MACDeq0 3=HLC 4=BBands>",1,4,1);

    a1:= 2/(t1+1);

    a2:= 2/(t2+1);

    CMACDeq:=(Ref(Mov(C,t1,E)*a1,-1)-Ref(Mov(C,t2,E)*a2,-1))/(a1-a2);

    HMACDeq:=(Ref(Mov(H,t1,E)*a1,-1)-Ref(Mov(H,t2,E)*a2,-1))/(a1-a2);

    LMACDeq:=(Ref(Mov(L,t1,E)*a1,-1)-Ref(Mov(L,t2,E)*a2,-1))/(a1-a2);

    MACDeq0:= Ref(Mov(C,t2,E)*(1-a2) - Mov(C,t1,E)*(1-a1),-1)/(a1-a2);

    z:= LastValue(If(pick > 2, 0, Cum(1)+1));

    plot1:= If(pick=3, HMACDeq, BBandTop(CMACDeq,10,S,1));

    plot2:= If(pick=2, MACDeq0, CMACDeq);

    plot3:= If(pick=3, LMACDeq, BBandBot(CMACDeq,10,S,1));

    plot1 + Ref(0,+z);

    plot2;

    plot3 + Ref(0,+z);

    1. Ok to close the Indicator Editor.
    1. New to open the Indicator Editor for the second indicator.
    2. t1:= Input("fast periods", 5, 24, 12);

      t2:= Input("slow periods", 10, 52, 26);

      t3:= Input("signal periods", 3, 18, 9);

      pick:= Input("plot: <1=MACD 2=MACD_HLC 3=MACD_MTF>",1,4,1);

      MACDH:=Mov(H,t1,E)-Mov(H,t2,E);

      MACDL:=Mov(L,t1,E)-Mov(L,t2,E);

      MACDC:=OscP(12,26,E,$);

      MTFw:=OscP(12*5,26*5,E,$);

      MTFM:=OscP(12*21,26*21,E,$);

      y:= LastValue(If(pick <>2, 0, Cum(1)+1));

      z:= LastValue(If(pick > 1, 0, Cum(1)+1));

      plot1:= MACDC;

      plot2:= If(pick=2, MACDH, MTFw);

      plot3:= If(pick=2, MACDL, MTFm);

      plot4:= Mov(MACDC,t3,E);

      plot1;

      plot2 + Ref(0,+z);

      plot3 + Ref(0,+z);

      plot4 + Ref(0,+y);

      1. Ok to close the Indicator Editor.
      2. Ok to close the Indicator Builder.

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.