Announcement

Collapse
No announcement yet.

EasyLanguage Q

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • EasyLanguage Q

    Hi,

    Can anyone tell me what the following easy language line is doing:

    p:=Var>Ref(Var,-1); q:=Var<Ref(Var,-1);

    Obviously it is setting p and q to some value...but the conditional for the value throws me. It seems that it could be either trying to set P and q to true or false, but this doesn't make sense to the rest of the code.

    It seems it could also be saying set P to the greater of either Var or Var from one bar ago and q to the lesser of Var or Var one bar ago. This would kind of make sense...but I want to make sure I am correct.

    Garth
    Garth

  • #2
    Re: EasyLanguage Q

    Originally posted by gspiker
    Hi,

    Can anyone tell me what the following easy language line is doing:

    p:=Var>Ref(Var,-1); q:=Var<Ref(Var,-1);
    It's setting p and q to boolean values - true or false. Same as:

    if Var>Ref(Var, -1) then
    p = true
    else
    p = false;

    etc.

    Comment


    • #3
      Thanks Don.

      Now that totally throws me for what the rest of the code is doing, since both q and p are used in math formula's a bit later.

      Hmmm. It's a puzzler, unless someone is taking advatage of true = 1 and false = 0...but even then it doesn't really work...

      Thanks again.

      Garth
      Garth

      Comment


      • #4
        Maybe trying to figure out if an indicator is moving up or down, 0=up, 1=down.

        just an idea

        Comment


        • #5
          David,

          That is fairly close to correct as it ends up. They were using the 1 and 0 in a math formula so that the trend of one indicator would effect the trend of another.

          Thanks,

          Garth
          Garth

          Comment


          • #6
            Ok here is another.

            I assume Peak(5,H,Pct) is asking for the last peak that was followed by a 5% decline?

            And a PeakBars() of the same is asking for what? How many bars ago that peak happened?

            Garth
            Garth

            Comment


            • #7
              I bet there is a subroutine or label called Peak, with three variables, inside the program you are reviewing.

              Peak and/or PeakValue do not appear to be native esl code words

              Comment


              • #8
                Thanks David,

                I wish it were true, but it isn't. That just might mean that the person who sent me the formula's to traslate didn't have the entire formula copied into their email however.

                Thanks for the pointer...I will try to confim.

                Garth
                Garth

                Comment


                • #9
                  A quick search of the internet may have revieled the problem. The person said this was EL code, but it looks like peak and peakbars is part of the metastock API. So they might have been confused...

                  Thanks again for your help...now I have to try to figure out what it means in metastockian ;-)

                  G
                  Garth

                  Comment


                  • #10
                    Garth
                    Below are the definitions of Peak and PeakBars from Metastock Help files
                    If you also need the ZigZag definition let me know
                    Alex


                    SYNTAX peak( Nth, DATA ARRAY, % MINIMUM CHANGE )

                    FUNCTION Plots the value of DATA ARRAY Nth peak(s) ago. This uses the Zig Zag function (see Zig Zag) to determine the peaks. N=1 would return the value of the most recent peak. N=2 would return the value of the 2nd most recent peak. Etc.

                    EXAMPLE peak(1,close,5)




                    SYNTAX peakbars( Nth, DATA ARRAY, % MINIMUM CHANGE)

                    FUNCTION Plots the number of bars that have passed from the Nth peak. This uses the Zig Zag function (see Zig Zag) to determine the peaks. N=1 would return the number of bars that have passed since the most recent peak. N=2 would return the number of bars that have passed since the 2nd most recent peak. Etc.

                    EXAMPLE peakbars(1,close,5)

                    Comment


                    • #11
                      Thanks Alex. That's close to what I assumed.

                      I found the zigzag formula written by TSSupport and modifed by a number of people on this board. So I think, because of their work, I have that covered.

                      Thanks again to everyone for their help.

                      Garth
                      Garth

                      Comment

                      Working...
                      X