in Search

MACD average

Last post 12-24-2007, 3:19 by pumrysh. 7 replies.
Sort Posts: Previous Next
  •  12-17-2007, 10:24 26083

    MACD average

    Wanted to create an indicator which calculate a 10 days average of the MACD() on monday. For example, today is monday and the indicator would plot the 10 days average of the MACD() value on the previous 10 mondays.

    Tried the following but result plot continue to other day (Should remain zero for other days) (Plot on monday)

    MD:=if(Dayofweek()=1,MACD(),0);
    Mov(MD,10,S)

  •  12-18-2007, 11:25 26097 in reply to 26083

    Re: MACD average

    Flexi,

    Try this:

    MD:=Mov(MACD(),10,S);
    if(Dayofweek()=1,MD,0);

     

    Hope this helps,

     

    Preston

     



    equismetastock@yahoogroups.com
  •  12-19-2007, 0:59 26100 in reply to 26083

    Re: MACD average

    Hi Preston,

    The code does not give what is intended. The idea is taking the MACD() values on only 10 previous monday and divided by 10. Only MACD() values on moday are considered and averaged. Plot this average on the monday.

    The code average MACD() average all values from monday to friday which is not intended.

  •  12-19-2007, 16:33 26104 in reply to 26100

    Re: MACD average

    Flexi,

    Your request was "Wanted to create an indicator which calculate a 10 days average of the MACD() on monday. For example, today is monday and the indicator would plot the 10 days average of the MACD() value on the previous 10 mondays. "

    Normally, a MACD is calculated by subtracting a 26 EMA from a 12 EMA. A Weekly MACD uses the close of the week which in most cases would be a Friday.

    There are a number of excellent sources for a weekly MACD but I am afraid that they will likely use the Friday close. You will need to make that adjustment. The best sources that I know of would be either Roy's or Jose's sites. They can be found here:

    http://www.metastocktips.co.nz/other_formulas.html

     

    http://www.metastocktools.com/#metastock

     

    Trades online offers one but it is probably not what you want. Here is the link anyway:

     

    http://trader.online.pl/MSZ/e-w-MACD_Histogram.html

     

    Hope this helps,

     

    Preston

     

     



    equismetastock@yahoogroups.com
  •  12-20-2007, 7:44 26109 in reply to 26104

    Re: MACD average

    Hi Preston,

    I am not coding weekly MACD but just want to plot the average of MACD on 10 previous monday. Only monday values are added and divided for the average. The value calculated will be plotted on moday and not other day

  •  12-20-2007, 9:10 26110 in reply to 26109

    Re: MACD average

    This what you had in mind?

     

    MMD:= ValueWhen(1,DayOfWeek()=1,MACD());
    MAMD:=Mov(mmd,10,S);
    If(DayOfWeek()=1,MAMD,0);

     

    Preston



    equismetastock@yahoogroups.com
  •  12-22-2007, 10:24 26138 in reply to 26110

    Re: MACD average

    Hi Preston,

    MMD:= ValueWhen(1,DayOfWeek()=1,MACD());
    MAMD:=Mov(mmd,10,S);
    If(DayOfWeek()=1,MAMD,0);

    The second code does not average the monday Macd(). Trying to create something:

    MMD:= ValueWhen(1,DayOfWeek()=1,MACD());
    MMD1:= ValueWhen(2,DayOfWeek()=1,MACD());
    MMD2:= ValueWhen(3,DayOfWeek()=1,MACD());

    If(DayOfWeek()=1,MAMD + MMD1 + MMD2,0);

    The problem with using valuewhen is require to define each previous value and for a average of 20 there are 20 definition MMD. Is there a good way to code this?

    Regards.

     

  •  12-24-2007, 3:19 26151 in reply to 26138

    Re: MACD average

    Flexi,

    MAMD:=Mov(mmd,10,S);

    and

    MAMD:=Sum(mmd,10)/10;

    would be the same. If you prefer 20 you would simply change the periods.

    Preston



    equismetastock@yahoogroups.com
View as RSS news feed in XML