Announcement

Collapse
No announcement yet.

highest(10, high()) one bar ago?

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

  • highest(10, high()) one bar ago?

    Hi,

    how can I manage the problem, that the value for a highest high not include the current bar?


    Franz
    Franz

  • #2
    Why not use a for() command to load an array.

    If you provide the EFS code, maybe I can help.
    Tex

    Comment


    • #3
      I am new in EFS2 programming, I am a Visual Basic and TradeStation programmer, I dont no how is the syntax for the for()-command.

      I have only the documents in the doc-folder to train the EFS2-syntax.

      You are right, that I can manage it with the for()-command, maybe you have a small-example to handle the highest-high-problem for one bar ago.
      Franz

      Comment


      • #4
        Franz,

        EFS and EFS2 is an extension of JavaSript, FWIW, the knowledgebase is under the Support tab, here is a link
        Last edited by Guest; 06-11-2005, 01:15 PM.

        Comment


        • #5
          Franz
          Use highest(length,offsetSeries(high(),nn)) where nn is the value by which you want to offset (ie displace). Positive numbers displace forward, negative backwards.
          If instead you want to offset the whole plot then use offsetSeries(length,high()),nn)
          Alex

          Comment


          • #6
            First of all, get the latest help.chm files here! I'm not sure if this is all that is available, but it's what I have found so far.




            Put it on your desktop and open it when needed.

            Secondly, if you want me to write the script example, I would be more than happy to, but haven't used the "highest" or "hhv" function before and do it manually. Essentially, it is constructed something like what follows:

            SPer = 10;
            vHigh = getValue("High",0 , -SPer);
            HHigh = 0;
            LHigh = 0;

            for(i = 1; i < SPer; i++) // start with the previous bar
            {
            LHigh = vHigh[i];
            if(LHigh > HHigh) HHigh = LHigh;
            }


            debugPrintln(HHigh);


            The last bar in any series of bars starts with index zero (0) and moves left. We simply skip the last bar by starting with offset 1 instead of zero.

            This snipet works in one of my VMA EFS files.
            Tex

            Comment


            • #7
              LOL! Alexis always faster than me and a LOT more knowledge about EFS.

              LOL!

              However, your method isn't so clear in the HELP file, especially for beginners!

              ******************************************
              New in EFS2. This function will return the highest value found in a series within numBars number of bars.

              Parameters

              numBars
              the number of bars back to search

              series
              the series in which to search for the value



              Usage

              function main() {
              var myVar1;

              //find the highest-high over the last 50 bars
              myVar1 = highest( 50, high() );

              }
              *************************

              No "OFFSET" shown available in help file as a function of the offsetSeries() variable.


              Last edited by Tex50; 06-11-2005, 02:11 PM.
              Tex

              Comment


              • #8
                Tex

                No "OFFSET" shown available in help file.

                It is in the Help file under Series Functions. Copy of the help file is also available in the EFS KnowledgeBase under EFS Function Reference and EFS2 Function Reference
                Alex

                Comment


                • #9
                  True, I didn't express myself properly. To a beginner, embedding functions within variables within another function may be hard to grasp. The other item is that while the one sentence function may work the same as what I did manually, it lacks the "functional flow" to the code for a beginner. One must memorized the whole EFS library in order to know what is available before coding.

                  OTOH, with simple stuff, the same functionality can be obtained that allows a beginner to get a handle on things with minimum intrinsic knowledge.

                  Millions of ways to skin a cat, who cares so long as the cat gets skinned?

                  Just a beginner trying to help other beginners... maybe I should just shut up and leave it up to ya'll!

                  Tex

                  Comment


                  • #10
                    Tex
                    I understand what you are saying and that is why together with EFS2 eSignal also introduced the Toolbox which helps build all these functions merely through point and click. To access the Toolbox click the f(x) icon in the Formula Editor
                    Alex

                    Comment


                    • #11
                      Just more excellence from ya'll! I hadn't noticed that since I upgraded.

                      I'm overloaded with all the help now! Love it! Never the less, my stuff works in its simplistic fashion for now. I hope to ellaborate on a new strategy EFS in progress and the help ya'll have provided saves tons of work!

                      Thanks again!


                      Tex

                      Comment


                      • #12
                        Tex50, thank you for your for()-command-example, works fine!

                        I though, that its easier with EFS2, for example the following codes (which dont work):

                        return(highest(10,offsetSeries(high(),-1);

                        or

                        HH = highest(10,high());
                        return(HH(1));

                        I get no chart with above code.

                        May be I have to accustom to the way of writing, like high(-1) instead of high(1)...
                        Franz

                        Comment


                        • #13
                          Franz
                          FYI highest(10,offsetSeries(high(),n)) does work (see this reply earlier in this same thread for the syntax).
                          Here is a sample script and the result plotted on the chart. In the image the red plot is the one that is offset
                          Alex

                          PHP Code:
                          function preMain(){
                              
                          setPriceStudy(true);
                              
                          setStudyTitle("test");
                              
                          setCursorLabelName("no offset",0);
                              
                          setCursorLabelName("offset",1);
                              
                          setDefaultBarFgColor(Color.blue,0);
                              
                          setDefaultBarFgColor(Color.red,1);
                          }

                          function 
                          main(){

                              return new Array (
                          highest(10,high()), highest(10,offsetSeries(high(),1)));

                          Comment


                          • #14
                            Alex you are right!


                            One more question for today:

                            How can I draw a Session-Break-Line, when I use setDefaultBarBgColor? Its normal, that I cant draw anything, when I use setDefaultBarBgColor?
                            Franz

                            Comment

                            Working...
                            X