in Search

Counting of days

Last post 09-20-2008, 15:51 by DonVinci. 4 replies.
Sort Posts: Previous Next
  •  09-16-2008, 2:58 27884

    Counting of days

    Dear all

    Could you please let me know how to setup the following:

    If C > MovAvg begin to sum-up the +1 days

    and the same

    If C < Mov-Avg begin to sum-up the -1 days

    Always starting from zero after the signal.

    Many thanks for your support!

    Have a good day!

  •  09-16-2008, 17:17 27891 in reply to 27884

    Re: Counting of days

    Please define "the signal"


    www.premiumdata.net
  •  09-17-2008, 2:41 27892 in reply to 27891

    Re: Counting of days

    Close crosses MovAvg. / opening the next day
  •  09-17-2008, 9:31 27893 in reply to 27892

    Re: Counting of days

    Give this a go:

    barcount:=Cum(1);
    movavg := Mov(C,20,S);
    above := C>=movavg;
    below := C<movavg;
    crossabove := Cross(C,movavg);
    crossbelow := Cross(movavg,C);
    abovecount := barcount-ValueWhen(1,crossabove,Cum(1))+1;
    belowcount := -1 * (barcount-ValueWhen(1,crossbelow,Cum(1))+1);

    valuetoprint := If(above,abovecount,belowcount);
    valuetoprint;


    www.premiumdata.net
  •  09-20-2008, 15:51 27913 in reply to 27893

    Re: Counting of days

    Great! Many thanks!

    Kind regards

    Vince

View as RSS news feed in XML