Announcement

Collapse
No announcement yet.

OHLC Correct Prices

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

  • OHLC Correct Prices

    Hello all,

    I'm trying to get the correct OHLC (and subsequent Pivot Values) NOT based on Settlement prices, but on the chart time established by my time templates (in my case 8:00 a.m. - 16:15 pm.). Thanks to the previous posts by Alex and others, I've been able to modify the previous close, but erroneous values still appear on the previous High, Low and Open. Sometimes they're correct, other times incorrect, but ONE of the three is always incorrect.

    I know this is corrected in V11, but I'm still using 10.6.

    Can anyone help me? I'm sure I'm missing something in the EFS, but it is beyond my ability. I tried modifying the formula on the OHL in the same manner as the Close, but it did not work.

    Here is what I have done so far:
    /************************************************** ****************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2005. 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.
    @version 3.0 by Alexis Montenegro for eSignal
    ************************************************** *****************************************/

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("PreviousDayDailyBars mod");
    setCursorLabelName("PD-O", 0); // Open
    setCursorLabelName("PD-H", 1); // High
    setCursorLabelName("PD-L", 2); // Low
    setCursorLabelName("PD-C", 3); // Close

    setDefaultBarStyle(PS_SOLID, 0); // Open
    setDefaultBarStyle(PS_SOLID, 1); // High
    setDefaultBarStyle(PS_SOLID, 2); // Low
    setDefaultBarStyle(PS_SOLID, 3); // Close

    setDefaultBarFgColor(Color.maroon, 0); // Open
    setDefaultBarFgColor(Color.black, 1); // High
    setDefaultBarFgColor(Color.black, 2); // Low
    setDefaultBarFgColor(Color.RGB (128,0,255), 3); // Close

    setDefaultBarThickness(2, 0); // Open
    setDefaultBarThickness(2, 1); // High
    setDefaultBarThickness(2, 2); // Low
    setDefaultBarThickness(2, 3); // Close

    setPlotType(PLOTTYPE_FLATLINES, 0); // Open
    setPlotType(PLOTTYPE_FLATLINES, 1); // High
    setPlotType(PLOTTYPE_FLATLINES, 2); // Low
    setPlotType(PLOTTYPE_FLATLINES, 3); // Close
    }

    var bInit = false;
    var xOpen = null;
    var xHigh = null;
    var xLow = null;
    //var xClose = null; //removed
    var vClose; //added

    function main() {

    if(isMonthly() || isWeekly() || isDaily())
    return;

    if(bInit == false){
    xOpen = open(inv("D"));
    xHigh = high(inv("D"));
    xLow = low(inv("D"));
    //xClose = close(inv("D")); //removed
    bInit = true;
    }

    var vOpen = xOpen.getValue(-1);
    var vHigh = xHigh.getValue(-1);
    var vLow = xLow.getValue(-1);
    //var vClose = xClose.getValue(-1); //replaced with line below
    if (day(0)!=day(-1)) vClose = close (-1); //added


    if(vOpen == null || vHigh == null || vLow == null || vClose == null)
    return;


    return new Array (vOpen,vHigh,vLow,vClose);
    }
    Attached Files

  • #2
    I would be interested in this one as well. A pivot based on my own time templates.

    Another option would be pivot based on time values in the script. How do i get the the value of yesterday at eg 8 am?
    follow the white rabbit

    Comment


    • #3
      Re: OHLC Correct Prices

      turbotrade
      FWIW the values returned by the script are not incorrect. They are based on the daily bar [as that is the interval passed to the open(), high() and low() functions] which includes the entire trading session whereas your chart only covers part of it.
      I have posted a couple of scripts in this and this thread that show how to resolve this in different ways
      Alex


      Originally posted by turbotrade
      Hello all,

      I'm trying to get the correct OHLC (and subsequent Pivot Values) NOT based on Settlement prices, but on the chart time established by my time templates (in my case 8:00 a.m. - 16:15 pm.). Thanks to the previous posts by Alex and others, I've been able to modify the previous close, but erroneous values still appear on the previous High, Low and Open. Sometimes they're correct, other times incorrect, but ONE of the three is always incorrect.

      I know this is corrected in V11, but I'm still using 10.6.

      Can anyone help me? I'm sure I'm missing something in the EFS, but it is beyond my ability. I tried modifying the formula on the OHL in the same manner as the Close, but it did not work.

      Here is what I have done so far:
      /************************************************** ****************************************
      Copyright © eSignal, a division of Interactive Data Corporation. 2005. 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.
      @version 3.0 by Alexis Montenegro for eSignal
      ************************************************** *****************************************/

      function preMain() {
      setPriceStudy(true);
      setStudyTitle("PreviousDayDailyBars mod");
      setCursorLabelName("PD-O", 0); // Open
      setCursorLabelName("PD-H", 1); // High
      setCursorLabelName("PD-L", 2); // Low
      setCursorLabelName("PD-C", 3); // Close

      setDefaultBarStyle(PS_SOLID, 0); // Open
      setDefaultBarStyle(PS_SOLID, 1); // High
      setDefaultBarStyle(PS_SOLID, 2); // Low
      setDefaultBarStyle(PS_SOLID, 3); // Close

      setDefaultBarFgColor(Color.maroon, 0); // Open
      setDefaultBarFgColor(Color.black, 1); // High
      setDefaultBarFgColor(Color.black, 2); // Low
      setDefaultBarFgColor(Color.RGB (128,0,255), 3); // Close

      setDefaultBarThickness(2, 0); // Open
      setDefaultBarThickness(2, 1); // High
      setDefaultBarThickness(2, 2); // Low
      setDefaultBarThickness(2, 3); // Close

      setPlotType(PLOTTYPE_FLATLINES, 0); // Open
      setPlotType(PLOTTYPE_FLATLINES, 1); // High
      setPlotType(PLOTTYPE_FLATLINES, 2); // Low
      setPlotType(PLOTTYPE_FLATLINES, 3); // Close
      }

      var bInit = false;
      var xOpen = null;
      var xHigh = null;
      var xLow = null;
      //var xClose = null; //removed
      var vClose; //added

      function main() {

      if(isMonthly() || isWeekly() || isDaily())
      return;

      if(bInit == false){
      xOpen = open(inv("D"));
      xHigh = high(inv("D"));
      xLow = low(inv("D"));
      //xClose = close(inv("D")); //removed
      bInit = true;
      }

      var vOpen = xOpen.getValue(-1);
      var vHigh = xHigh.getValue(-1);
      var vLow = xLow.getValue(-1);
      //var vClose = xClose.getValue(-1); //replaced with line below
      if (day(0)!=day(-1)) vClose = close (-1); //added


      if(vOpen == null || vHigh == null || vLow == null || vClose == null)
      return;


      return new Array (vOpen,vHigh,vLow,vClose);
      }

      Comment


      • #4
        Thanks so much Alex - the links are great. I have to keep working on this as I realized I need to modify the O, H & L to RTH start hrs (9:30 am), but keep on an 8:00 am time template.

        Comment

        Working...
        X