Announcement

Collapse
No announcement yet.

New hi and low of the day not refreshing

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

  • New hi and low of the day not refreshing

    The high and low lines need to be refreshed all day to get the new hi lows. I would think they should automatically change with each bar. Here is my EFS on it. Could you check why no updates or change to newest low or high.


    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Today's High (TH)");
    setCursorLabelName("TH");

    /*
    * 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.aqua);
    setDefaultBarThickness(3);
    setPlotType(PLOTTYPE_FLATLINES);

    }

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


    Thanks Alex.
    }

  • #2
    Hello earlinarizona,

    The formula you've posted does not update the returned values on historical bars. EFS executes on the current bar, so your formula in question returns what the high was at the time of the bars. At the moment the formula is applied to the chart it returns what the currents day's high is. In real time, as new bars arrive, a new high is only reflected on the current bar. In order to have the historical bars updated you need to employ a routine similar to the example below. Alternatively, if you could use the setBar() function in a loop to go back and update the previous bar's return values.

    TodaysHighLine.efs

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Today's High line");
        
    setShowCursorLabel(false);
    }

    var 
    vHigh null;
    var 
    x1 null;

    function 
    main() {
        if (
    getDay() != getDay(-1)) {
            
    vHigh high();
            
    x1 getCurrentBarIndex();
        }
        
        if (
    x1 == nullx1 getCurrentBarIndex();
        
        var 
    callFunction("/OHLC/getTodayOHLC.efs""main""High");
        if (
    != null) {
            
    vHigh Math.max(vHighh);
        }
        
    drawLineRelative(x1vHigh0vHighPS_SOLID3Color.aqua"High");
        
        return 
    null;

    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


    • #3
      Still problem with auto refresh

      I placed your EFS on my chart and it set itself to a random level. Not the high or low of the day. Could you rechek the efs. Just want it to act like todays hi and todays low but with auto refresh on every bar. I am a good trader but have a world of trouble doing a formula. A complete hi and low formula would be VERY appreciated. You are much better in this area then me.

      Comment


      • #4
        Hello earlinarizona,

        You're right, there was a problem with the original formula. You'll need to download getTodayOHLC1.efs and save this to your \eSignal\Formulas\OHLC\ folder. Please make note of the "1" at the end of the file name. This is a different formula than getTodayOHLC.efs. I made a minor change to TodaysHighLine.efs as well. Download this one again as well. It should be working for you now. Let me know if you have any more problems or questions.

        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


        • #5
          Small change needed on Hi low

          I am using this efs you made the last week and it updates fine. Save me a lot of reload buttons.
          ONly problem which can easily be solved.
          If I have my start time at 930 and end time 1600 it only knows the hi and low of that time, but everyones normal hi low and the manual one goes from hour oooo to 23:60. The hi and low change with the time period, but should alwas be based on the full 24 hour times. There could be a big rocket during the nigh and if it fails you will never see that in your hi low. This one should be easy.
          Thanks.

          Comment


          • #6
            Noticed no display of values

            There are also no values of where the linee is. Normally on right side of chart. Selected on edit properties to place on right side but nothing. Also changed background colors and it is not hiding. Could you also add that to the EFS.
            Thanks

            Comment


            • #7
              Hello earlinarizona,

              I've made a new formula for you that is basically the same logic as TodaysHighLine.efs. This one, TodaysHighLow.efs, also includes today's low. The reason the previous formula does not have a label on the y-axis is because the formula did not return any numbers to be plotted on the chart. The formula displays the high line using the drawLineRelative() function. The new formula returns the data to be plotted on the chart (blue lines) in addition to the drawn line (aqua line). The blue lines will look similar to the Donchian study and will not be updated on a historical basis as new highs or lows are reached in real time.

              In regards to the 24-hour high and low, I believe this formula already shows that data. The image below is using the West Coast RTH time template, which ends at 13:00 PST. You can see that the low of 1031.00 did not occur during the regular trading hours, but after the close.


              This image is the same formula on the 24-hour time template.


              Let me know if this new formula works for you.
              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


              • #8
                Thanks Works like a charm

                One last little cosmetic change. Yesterday and days previous now have dashed lines for hi low as I updated that. The only change would be to get the dashed line for today. I added dash on top section but nt affecting todays. This is purely cosmetic as the EFS works perfectly. Where would I place the dash command for todays line and what code?
                Thanks. This setup has made it very easy for me.
                Earl

                Comment


                • #9
                  Here is the EFS I updated forgot

                  function preMain() {
                  setPriceStudy(true);
                  setStudyTitle("Auto High Low");
                  setCursorLabelName("High", 0);
                  setCursorLabelName("Low", 1);
                  setDefaultBarStyle(PS_DASH, 0);
                  setDefaultBarStyle(PS_DASH, 1);
                  setDefaultBarFgColor(Color.aqua, 0);
                  setDefaultBarFgColor(Color.red, 1);
                  setDefaultBarThickness(3,0);
                  setDefaultBarThickness(3,1);
                  setPlotType(PLOTTYPE_FLATLINES, 0);
                  setPlotType(PLOTTYPE_FLATLINES, 1);



                  }

                  var vHigh = null;
                  var vLow = null;
                  var x1 = null;

                  function main() {
                  if (getDay() != getDay(-1) || vHigh == null) {
                  vHigh = high();
                  vLow = low();
                  x1 = getCurrentBarIndex();
                  }

                  if (x1 == null) x1 = getCurrentBarIndex();

                  var h = callFunction("/OHLC/getTodayOHLC1.efs", "main", "high");
                  var l = callFunction("/OHLC/getTodayOHLC1.efs", "main", "low");
                  if (h == null || l == null) return;

                  vHigh = Math.max(vHigh, h);
                  vLow = Math.min(vLow, l);
                  if (getCurrentBarIndex() == 0 && getBarState() == BARSTATE_NEWBAR) x1 -= 1;
                  // High
                  drawLineRelative(x1+1, vHigh, 0, vHigh, PS_DASH, 3, Color.aqua, "High");
                  drawTextAbsolute(1, vHigh, vHigh.toFixed(4), Color.black, Color.aqua,
                  Text.VCENTER|Text.BOLD|Text.FRAME|Text.LEFT, null, 12, "highL");
                  // Low
                  drawLineRelative(x1+1, vLow, 0, vLow, PS_DASH, 3, Color.red, "Low");
                  drawTextAbsolute(1, vLow, vLow.toFixed(4), Color.black, Color.red,
                  Text.VCENTER|Text.BOLD|Text.FRAME|Text.LEFT, null, 12, "LowL");

                  return new Array(vHigh.toFixed(4)*1, vLow.toFixed(4)*1);
                  }

                  Comment


                  • #10
                    earlinarizona

                    I beleive there is a issue with the PS_ DASH in this case that is being worked on. I have the same problem, please be patient and hopefully it will be fixed soon.

                    Fibbgann
                    Excellent book on JavaScript for beginners

                    Comment


                    • #11
                      Hello Earl,

                      The flags such as PS_DASH, aren't working for drawLineRelative() currently. I've previously reported this to the development team. I'll send them another request to fix that for us.
                      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

                      Working...
                      X