Announcement

Collapse
No announcement yet.

Todays Open

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

  • Todays Open

    Is it possible to get todays open from the OHLCefs that comes with esignal and compare it with the close of the last bar? For example enter long if close of this bar is greater than todays open.

  • #2
    czumwalt
    Yes it is possible.
    First create a variable for example

    var vOpen = callFunction("/OHLC/getTodayOHLC.efs", "main", "Open");

    then use the variable in the condition for example

    if (close() > vOpen)
    Strategy.doLong("", Strategy.MARKET, Strategy.NEXTBAR, Strategy.DEFAULT, 0);

    Alex

    Comment


    • #3
      In the Todays open.efs which makes a call to getTodayOHLC.efs, can it be programmed to print the today's opening price on the line that is drawn across the screen rather than in the margin?

      I find that often I get totally lost looking at all the pretty colours in the right hand side margin!

      The contents of the script are:

      function preMain() {
      setPriceStudy(true);
      setStudyTitle("Today's Open (TO)");
      setCursorLabelName("TO");

      /*
      * Set the properties of the default bar. These will be the
      * properties of any bar for which style, color, thickness is
      * not specificed.
      */
      setDefaultBarStyle(PS_DASH);
      setDefaultBarFgColor(Color.blue);
      setDefaultBarThickness(1);
      setPlotType(PLOTTYPE_FLATLINES);

      }

      /*
      * This is a neat formula because it is working on multiple intervals
      */
      function main() {
      return call("getTodayOHLC.efs", "Open");

      Comment


      • #4
        Highfield
        The enclosed efs will write today's Open value on the chart.
        Alex

        PHP Code:
        /****************************************************************************************************
        Copyright © eSignal, a division of Interactive Data Corporation. 2002. All rights reserved. 
        This sample eSignal Formula Script (EFS) may be modified and saved under a new 
        filename; however, eSignal is no longer responsible for the functionality once modified.
        eSignal reserves the right to modify and overwrite this EFS file with each new release.
        *****************************************************************************************************/
        function preMain() {
            
        setPriceStudy(true);
            
        setStudyTitle("Today's Open (TO)");
            
        setCursorLabelName("TO");

            
        /*
             * Set the properties of the default bar.  These will be the
             * properties of any bar for which style, color, thickness is
             * not specificed.
             */
            
        setDefaultBarStyle(PS_DASH);
            
        setDefaultBarFgColor(Color.blue);
            
        setDefaultBarThickness(1);
            
        setPlotType(PLOTTYPE_FLATLINES);

        }

        /*
         * This is a neat formula because it is working on multiple intervals
         */
        function main() {

        var 
        vOpen call("getTodayOHLC.efs""Open");
        drawTextRelative(3,vOpen,vOpen,Color.blue,null,Text.VCENTER|Text.BOLD,"Arial",11,0);

            return 
        vOpen;

        Last edited by ACM; 08-26-2003, 10:48 AM.

        Comment


        • #5
          That's just super Alexis. I get the impression that you just take all these requests in your stride?

          Thanks again.

          Comment


          • #6
            Alexis - It doesn't appear to want to print today's Open price and the script causes an error when run:

            Parameter Number 3 of Function drawTextRelative is invalid.

            Line 43 is:

            drawTextRelative(3,vOpen,vOpen,Color.blue,null,Tex t.VCENTER|Text.BOLD,"Arial",11,0);
            Attached Files

            Comment


            • #7
              Highfield
              I just copied it from the thread and it is definitely working here.
              Is the text block at the top of the formula all grayed out?
              If not check make sure there is no space between the first / and the *.
              What version of the program are you running?
              Alex

              Comment


              • #8
                At first it wasn't greyed out so I removed the heading and tried it without.

                I'm using v7.4 (Build 608)

                Perhaps I need a newer version of getTodayOHLC.efs?
                Last edited by Highfield; 08-26-2003, 12:17 PM.

                Comment


                • #9
                  Highfield
                  I have asked Jason or Jay to look at this because I cannot find the reason as to why it would not work.
                  Alex

                  Comment


                  • #10
                    Hello Highfield,

                    I think your problem has to do with where you placed your formula. Alex's code example will only work if you saved your formula to the \OHLC\ folder. I changed the path info for the call to getTodayOHLC.efs so you can download the modified version below and place it anywhere in eSignal\Formulas\. Give this one a try.
                    Attached Files
                    Jason K.
                    Project Manager
                    eSignal - an Interactive Data company

                    EFS KnowledgeBase
                    JavaScript for EFS Video Series
                    EFS Beginner Tutorial Series
                    EFS Glossary
                    Custom EFS Development Policy

                    New User Orientation

                    Comment


                    • #11
                      I knew about having the efs in the same folder and that's where it resides. I downloaded your version and put that in the OHLC folder but I still get the same error message:

                      Parameter Number 3 of Function drawTextRelative is invalid.

                      Also, it won't display today's open price, only yesterday's. I captured an image posted below and both scripts give the same result.

                      Will downloading another version of getTodayOHLC.efs help? Is there a link you point me at to download getTodayOHLC.efs?
                      Last edited by Highfield; 08-26-2003, 12:51 PM.

                      Comment


                      • #12
                        Hello Highfield,

                        Strange, I'm using the same version you are. Try these two formulas below. Save getTodayOHLC1.efs to \eSignal\Formulas\OHLC\.

                        getTodayOHLC1.efs
                        TodaysOpen.efs
                        Jason K.
                        Project Manager
                        eSignal - an Interactive Data company

                        EFS KnowledgeBase
                        JavaScript for EFS Video Series
                        EFS Beginner Tutorial Series
                        EFS Glossary
                        Custom EFS Development Policy

                        New User Orientation

                        Comment


                        • #13
                          Absolutely splendid! I copied both files and it works a expected.

                          Thank you all for your time a patience.

                          Do you think it would be better for me to delete the old todaysOHLC.efs and just use the new todaysOHLC1.efs?

                          Comment


                          • #14
                            I've been trying to hack the script to produce yesterday's high and low plus todays open. I've tried this:
                            /************************************************** **************************************************
                            Copyright © eSignal, a division of Interactive Data Corporation. 2002. All rights reserved.
                            This sample eSignal Formula Script (EFS) may be modified and saved under a new
                            filename; however, eSignal is no longer responsible for the functionality once modified.
                            eSignal reserves the right to modify and overwrite this EFS file with each new release.
                            ************************************************** ************************************************** */

                            function preMain() {
                            setPriceStudy(true);
                            setStudyTitle("P Hi/ P Lo/T Op");
                            setCursorLabelName("P Hi", 0); // Open
                            setCursorLabelName("T Op", 1); // High
                            setCursorLabelName("P Lo", 2); // Low

                            var vOpen = null;
                            var vHigh = null;
                            var vLow = null;

                            /*
                            * Set the properties of the default bar. These will be the
                            * properties of any bar for which style, color, thickness is
                            * not specificed.
                            */

                            setDefaultBarStyle(PS_DASH,0);
                            setDefaultBarStyle(PS_DASH,1);
                            setDefaultBarStyle(PS_DASH,2);
                            setDefaultBarFgColor(Color.RGB(233,216,185),0);
                            setDefaultBarFgColor(Color.RGB(233,216,185),1);
                            setDefaultBarFgColor(Color.RGB(233,216,185),2);
                            setDefaultBarThickness(1,0);
                            setDefaultBarThickness(1,1);
                            setDefaultBarThickness(1,2);
                            setPlotType(PLOTTYPE_FLATLINES,0);
                            setPlotType(PLOTTYPE_FLATLINES,1);
                            setPlotType(PLOTTYPE_FLATLINES,2);

                            }

                            /*
                            * This is a neat formula because it is working on multiple intervals
                            */
                            function main() {

                            var vHigh = callFunction("getPrevOHLC.efs", "main", "High");
                            if (vHigh == null) return;
                            drawTextRelative(3,vHigh," Y HI: "+formatPriceNumber(vHigh)+" ",Color.RGB(230,220,190),null,Text.VCENTER|Text.FR AME,"Arial",10,0);

                            var vOpen = callFunction("getPrevOHLC.efs", "main", "Open");
                            if (vOpen == null) return;
                            drawTextRelative(3,vOpen," D OP: "+formatPriceNumber(vOpen)+" ",Color.RGB(250,180,180),null,Text.VCENTER|Text.FR AME,"Arial",10,0);

                            var vLow = callFunction("getPrevOHLC.efs", "main", "Low");
                            if (vLow == null) return;
                            drawTextRelative(3,vLow," Y LO: "+formatPriceNumber(vLow)+" ",Color.RGB(230,220,190),null,Text.VCENTER|Text.FR AME,"Arial",10,0);

                            return vHigh, vOpen, vLow;

                            }


                            But I don't think it's correct (as it doesn't do what I want it to :@) Any clues as to why?

                            Thank you

                            Is it possible to vary the line length?
                            Last edited by Highfield; 09-08-2003, 05:30 PM.

                            Comment


                            • #15
                              Highfield

                              Aside from a couple of errors in your formula (ie you used the same 0 tag in all three drawTextRelative and in the return you omitted to use new Array) you are actually confronting one limitation with callFunction() that you may be unaware of.

                              The way getPrevOHLC.efs is coded does not allow for two separate functions (in this case "High" and "Low") to be called using callFunction().
                              There are two workarounds.
                              - Make a copy of getPrevOHLC.efs and place it in another directory. Then point one callFunction() to one copy of getPrevOHLC.efs and the other callFunction() to the other copy in the different directory.
                              - Use Call() instead of callFunction() which is what I have implemented in the enclosed revision of your efs. While Call() is supposedly less efficient than callFunction() in this specific case the difference in performance between the two methods is negligible when measured using Performance Monitor.

                              A more complete solution (not for the faint of heart) is to rewrite getPrevOHLC.efs along the lines of what Jason did with getTodayOHLC1.efs which is a variant of getTodayOHLC.efs and that allows for multiple callFunctions to be used with it.

                              Lastly you mention that you wanted to plot also today's Open However in your efs you were calling the previous Open so I modified that line to point to getTodayOHLC.efs rather than getPrevOHLC.efs. In this case I use callFuntion() as this is the only call made to that efs.

                              Hope this helps

                              Alex



                              PHP Code:
                              function preMain() {

                              setPriceStudy(true);
                              setStudyTitle("P Hi/ P Lo/T Op");
                              setCursorLabelName("P Hi"0); 
                              setCursorLabelName("T Op"1); 
                              setCursorLabelName("P Lo"2); 
                              setDefaultBarStyle(PS_DASH,0);
                              setDefaultBarStyle(PS_DASH,1);
                              setDefaultBarStyle(PS_DASH,2);
                              setDefaultBarFgColor(Color.RGB(233,216,185),0);
                              setDefaultBarFgColor(Color.RGB(233,216,185),1);
                              setDefaultBarFgColor(Color.RGB(233,216,185),2);
                              setDefaultBarThickness(1,0);
                              setDefaultBarThickness(1,1);
                              setDefaultBarThickness(1,2);
                              setPlotType(PLOTTYPE_FLATLINES,0);
                              setPlotType(PLOTTYPE_FLATLINES,1);
                              setPlotType(PLOTTYPE_FLATLINES,2);

                              }

                              function 
                              main() {

                              var 
                              vHigh Call("getPrevOHLC.efs""High");
                              if (
                              vHigh == null) return;
                              drawTextRelative(3,vHigh," Y HI: "+formatPriceNumber(vHigh)+" ",Color.RGB(230,220,190),null,Text.VCENTER|Text.FRAME,"Arial",10,0);

                              var 
                              vOpen callFunction("getTodayOHLC.efs","main""Open");
                              if (
                              vOpen == null) return;
                              drawTextRelative(3,vOpen," D OP: "+formatPriceNumber(vOpen)+" ",Color.RGB(250,180,180),null,Text.VCENTER|Text.FRAME,"Arial",10,1);

                              var 
                              vLow Call("getPrevOHLC.efs""Low");
                              if (
                              vLow == null) return;
                              drawTextRelative(3,vLow," Y LO: "+formatPriceNumber(vLow)+" ",Color.RGB(230,220,190),null,Text.VCENTER|Text.FRAME,"Arial",10,2);

                              return new Array(
                              vHighvOpenvLow);


                              Last edited by ACM; 09-09-2003, 05:20 AM.

                              Comment

                              Working...
                              X