Announcement

Collapse
No announcement yet.

Historic Interval Data not Displayed

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

  • Historic Interval Data not Displayed

    I have a simple study that I run for QLD,30 that displays the ema(5,high), ema(5,low), ema(50,hlc3) of the 30 minute, day and week intervals.

    My problem is that there is limited historical data displayed for the weekly and daily intervals. There is 30 min data available from 6/22/06.

    The daily ema50 only displays to 3/2/12
    The daily ema5 High and Low only display to 12/27/11
    The weekly ema5 High and Low only display to 7/9/07

    It is odd that there is more than 4 years worth of the weekly data compared to the daily data.

    Also when I compare the daily values on the 30 chart with those on the daily chart they are not the same. ie ema(5,high(inv(D))) on the 30 chart is not the same as ema(5,high) on the daily chart. However the ema(5,high(inv(W))) on the 30 chart IS the same as ema(5,high) on the weekly chart.

    My timescale on all the charts is dynamic, but I have scrolled to the end of the available data on all the charts.

    I cannot see what I am doing wrong.
    Attached Files

  • #2
    Try:
    PHP Code:
    //http://forum.esignal.com/showthread.php?38456-Historic-Interval-Data-not-Displayed
    /*********************************************************
    Alexis C. Montenegro © July 2003                          
    Use and/or modify this code freely. If you redistribute it
    please include this and/or any other comment blocks and a 
    description of any changes you make.                      
    **********************************************************/


    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("MA Intervals");
        
    setCursorLabelName("HMA"0);
        
    setDefaultBarFgColor(Color.blue0);    // High MA color
        
    setDefaultBarThickness(20);           // High MA Thickness
        
    setPlotType(PLOTTYPE_LINE0);          // High MA plot type
        
    setCursorLabelName("LMA"1);
        
    setDefaultBarFgColor(Color.red1);     // Low MA color
        
    setDefaultBarThickness(21);           // Low MA Thickness
        
    setPlotType(PLOTTYPE_LINE1);          // Low MA plot type
        
    setCursorLabelName("MA50"2);
        
    setDefaultBarFgColor(Color.black2);   // MA50 color
        
    setDefaultBarThickness(22);           // MA50 Thickness
        
    setPlotType(PLOTTYPE_CIRCLE2);        // MA50 plot type
        
    setCursorLabelName("MAIH5"3);
        
    setDefaultBarFgColor(Color.blue3);    // Next Interval High MA5 color
        
    setDefaultBarThickness(23);           // Next Interval High MA5 Thickness
        
    setPlotType(PLOTTYPE_LINE3);          // Next Interval High MA5 plot type
        
    setCursorLabelName("MAIL5"4);
        
    setDefaultBarFgColor(Color.red4);     // Next Interval Low MA5 color
        
    setDefaultBarThickness(24);           // Next Interval Low MA5 Thickness
        
    setPlotType(PLOTTYPE_LINE4);          // Next Interval Low MA5 plot type
        
    setCursorLabelName("MAI50"5);
        
    setDefaultBarFgColor(Color.grey5);    // Next Interval MA50 color
        
    setDefaultBarThickness(35);           // Next Interval MA50 Thickness
        
    setPlotType(PLOTTYPE_LINE5);          // Next Interval MA50 plot type
        
    setCursorLabelName("MAIH5+"6);
        
    setDefaultBarFgColor(Color.RGB(100,100,255), 6);   // Next Interval MA5 color
        
    setDefaultBarThickness(26);           // Next Interval MA5 Thickness
        
    setPlotType(PLOTTYPE_LINE6);          // Next Interval MA5 plot type
        
    setCursorLabelName("MAIL5+"7);
        
    setDefaultBarFgColor(Color.RGB(255,100,100), 7);   // Next Interval MA5 color
        
    setDefaultBarThickness(27);           // Next Interval MA5 Thickness
        
    setPlotType(PLOTTYPE_LINE7);          // Next Interval MA5 plot type

        
    var fp25 = new FunctionParameter("fstartD"FunctionParameter.NUMBER);
        
    fp25.setName("Start Day");
        for (var 
    1<=31; ++i) {
            
    fp25.addOption(i);
        }
        
    fp25.setDefault(1);
        
        var 
    fp26 = new FunctionParameter("fstartM"FunctionParameter.NUMBER);
        
    fp26.setName("Start Month");
        for (var 
    1<=12; ++i) {
            
    fp26.addOption(i);
        }
        
    fp26.setDefault(1);
        
        var 
    fp27 = new FunctionParameter("fstartY"FunctionParameter.NUMBER);
        
    fp27.setName("Start Year");
        for (var 
    010; ++i) {
            
    fp27.addOption(2015-i);
        }
        
    fp27.setDefault(2009);

        var 
    fp28 = new FunctionParameter("fendD"FunctionParameter.NUMBER);
        
    fp28.setName("End Day");
        for (var 
    1<=31; ++i) {
            
    fp28.addOption(i);
        }
        
    fp28.setDefault(31);
        
        var 
    fp29 = new FunctionParameter("fendM"FunctionParameter.NUMBER);
        
    fp29.setName("End Month");
        for (var 
    1<=12; ++i) {
            
    fp29.addOption(i);
        }
        
    fp29.setDefault(12);
        
        var 
    fp30 = new FunctionParameter("fendY"FunctionParameter.NUMBER);
        
    fp30.setName("End Year");
        for (var 
    0<=10; ++i) {
            
    fp30.addOption(2015-i);
        }
        
    fp30.setDefault(2013);
        
    }
    var 
    bInit  false;  // initialization flag
    var xMAH,xMAL,xMA50,xMAIL5,xMAIH5,xMAI50,xMAIIL5,xMAIIH5//Note: declared as global variables since they are the indicator series variables

    function main(fstartDfstartMfstartYfendDfendMfendY) {
        var 
    startDate,endDate;//Note: declared as local variables since they are used within & outside of bInit
        
    var today,nHour,nMinute,runDate,marketOpen;//Note: these need to be outside of bInit so they are calculated on every tick to track time
        
    today = new Date();//Note: see "var today, ..."
        
    nHour today.getHours();//Note: see "var today, ..."
        
    nMinute today.getMinutes();//Note: see "var today, ..."
        
    runDate today.getDate()+"/"+(today.getMonth()+1)+"/"+today.getFullYear();//Note: see "var today, ..."
        
    marketOpen false;//Note: see "var today, ..."
        
    if ((nHour == && nMinute >= 30) || (nHour && nHour 15)){//Note: see "var today, ..."
            
    marketOpen true;
            
    debugPrintln("Market is open");setBarBgColor(Color.RGB(255,244,195));
        }
        if(
    bInit == false) {//Note: code within bInit only runs on first pass of main
            // This code block executes only once at the beginning of initialization.
            
    var MAInterval,MAInterval2;//Note: only used within bInit
            //cSymbol = getSymbol();
            
    var cInterval getInterval();
            var 
    startD fstartD;
            var 
    startM fstartM;
            var 
    startY fstartY;
            var 
    endD fendD;
            var 
    endM fendM;
            var 
    endY fendY;
            
            if (
    cInterval == "W"){ MAInterval "M"MAInterval2 "M";}
            if (
    cInterval == "D"){ MAInterval "W"MAInterval2 "M";}
            if (
    cInterval == 60){ MAInterval "D"MAInterval2 "W";}
            if (
    cInterval == 30){ MAInterval "D"MAInterval2 "W";}
            if (
    cInterval == 10){ MAInterval 30MAInterval2 "D";}
            if (
    cInterval == 1){ MAInterval 10MAInterval2 30;}
            
    debugPrintln("cInterval="+cInterval+". MAInterval="+MAInterval+". MAInterval2="+MAInterval2);
            
            
    xMAH ema(5high());
            
    xMAL ema(5low());
            
    xMA50 ema(50hlc3());
            
    xMAIL5 ema(5low(inv(MAInterval)));
            
    xMAIH5 ema(5high(inv(MAInterval)));
            
    xMAI50 ema(50hlc3(inv(MAInterval)));
            
    xMAIIL5 ema(5low(inv(MAInterval2)));
            
    xMAIIH5 ema(5high(inv(MAInterval2)));
            
            
    startDate = new Date(startYstartM-1startD);
            
    endDate = new Date(endYendM-1endD);
            
            
    bInit true;  // Prevents this code block from executing again.
            
        
    // if(bInit == false)
        
        // debugPrintln("New bar"); 
        
    var prevbarDate = new Date(getYear(-1), getMonth(-1)-1getDay(-1));
        var 
    barDate = new Date(getYear(0), getMonth(0)-1getDay(0));
        
    // debugPrintln("barDate = " + barDate);
        
        
    if (barDate startDate || barDate endDate) {
            
    //debugPrintln(nBarIndex+". Outside date range");
            
    return;
        } 
        return new Array(
    xMAH.getValue(0), xMAL.getValue(0),xMA50.getValue(0),
                         
    xMAIH5.getValue(0),xMAIL5.getValue(0),xMAI50.getValue(0), 
                         
    xMAIIH5.getValue(0),xMAIIL5.getValue(0));

    Also when I compare the daily values on the 30 chart with those on the daily chart they are not the same.
    I think it has to do with when eSignal starts the day in a daily interval vs intraday intervals.
    A search of the forum will yield various explanations for this. One of those can be found at:


    Wayne
    Last edited by waynecd; 03-12-2013, 07:24 AM.

    Comment


    • #3
      Thanks for your suggestion Wayne. Unfortunately it has not made any difference to the results. My historic interval data is being cut significantly short. Any other ideas??
      Richard

      Comment


      • #4
        richthomas
        The issue of the limited historical data is simply due to the reason explained in this thread
        If you create a daily and a weekly chart of the same symbol both set to load 300 bars and you run your script on them you will see that the plots will start on the same dates on those charts as on the 30 minute chart set to Dynamic
        All you need to do to resolve this is just implement either solution provided at the linked thread
        Alex


        Originally posted by richthomas View Post
        I have a simple study that I run for QLD,30 that displays the ema(5,high), ema(5,low), ema(50,hlc3) of the 30 minute, day and week intervals.

        My problem is that there is limited historical data displayed for the weekly and daily intervals. There is 30 min data available from 6/22/06.

        The daily ema50 only displays to 3/2/12
        The daily ema5 High and Low only display to 12/27/11
        The weekly ema5 High and Low only display to 7/9/07

        It is odd that there is more than 4 years worth of the weekly data compared to the daily data.

        Also when I compare the daily values on the 30 chart with those on the daily chart they are not the same. ie ema(5,high(inv(D))) on the 30 chart is not the same as ema(5,high) on the daily chart. However the ema(5,high(inv(W))) on the 30 chart IS the same as ema(5,high) on the weekly chart.

        My timescale on all the charts is dynamic, but I have scrolled to the end of the available data on all the charts.

        I cannot see what I am doing wrong.

        Comment

        Working...
        X