Announcement

Collapse
No announcement yet.

Getting historical data w/Diff Intervals

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

  • Getting historical data w/Diff Intervals

    Hi, I am trying to set up an EFS that brings up the Highest High and Lowest Low of the previous 3 days, in a 5min chart.

    I know the basic of coding, but I am getting an error message when I try to load the EFS, as I think when the program first runs, there is not enough bars to calculate the highs/lows of the past 3 days.

    Is there a simple way to solve this, say by making sure the bar count is over 100 or something like that. I have tried but I still cant figure it out. Any help would be greatly appreciated

    PS - Any idea why my date wont print either?


    function main()
    { var xdayhigh = threeDayHigh(); // the highest high of the user defined range


    debugPrintln(" xdayhigh value is " + xdayhigh.toFixed(2) + " on date " + h ) return xdayhigh; }

    function threeDayHigh() {
    var nNumBars = getCurrentBarCount();
    { if ( nNumBars < 100) return 0; }
    {
    var xlessone = high(-1, inv("D") );
    var xlesstwo = high(-2, inv("D") );
    var xlessthree = high(-3, inv("D") ); var xMaxx = Math.Max(xlessone, xlesstwo, xlessthree) return xMaxx; //
    }
    }

  • #2
    Re: Getting historical data w/Diff Intervals

    eurostoxx
    You have several syntax errors in your script caused by an improper use of curly brackets and of the max() method of the Math object [which in your code should be Math.max() and not Math.Max()]
    That said you can determine the values you want by simply using the highest() and lowest() functions and passing to them the daily interval through the inv() function as shown in the following basic example
    PHP Code:
    function main() {
        var 
    prev3dayhigh highest(3,high(inv("d")),-1); //alternatively use hhv() or upperDonchian()
        
    var prev3daylow  lowest(3,low(inv("d")),-1); //alternatively use llv() or lowerDonchian()
        
    if(prev3dayhigh==null || prev3daylow==null) return;//null check
        
    return new Array (prev3dayhigh,prev3daylow);

    For information and examples on the use of the highest() and lowest() functions see the corresponding articles in the EFS KnowledgeBase. See also the articles for the other functions mentioned in my comments in the code sample
    Alex


    Originally posted by eurostoxx
    Hi, I am trying to set up an EFS that brings up the Highest High and Lowest Low of the previous 3 days, in a 5min chart.

    I know the basic of coding, but I am getting an error message when I try to load the EFS, as I think when the program first runs, there is not enough bars to calculate the highs/lows of the past 3 days.

    Is there a simple way to solve this, say by making sure the bar count is over 100 or something like that. I have tried but I still cant figure it out. Any help would be greatly appreciated

    PS - Any idea why my date wont print either?


    function main()
    { var xdayhigh = threeDayHigh(); // the highest high of the user defined range


    debugPrintln(" xdayhigh value is " + xdayhigh.toFixed(2) + " on date " + h ) return xdayhigh; }

    function threeDayHigh() {
    var nNumBars = getCurrentBarCount();
    { if ( nNumBars < 100) return 0; }
    {
    var xlessone = high(-1, inv("D") );
    var xlesstwo = high(-2, inv("D") );
    var xlessthree = high(-3, inv("D") ); var xMaxx = Math.Max(xlessone, xlesstwo, xlessthree) return xMaxx; //
    }
    }

    Comment


    • #3
      thanks so much alexis Montenegro... i was reading through some of your posts on this forum and I just wanted to thank you for being a real helpful chap..

      would you be interested in doing a little custom work, for a fee of course. Maybe 5-10 hours work to start

      if so send me a msg: [email protected]

      happy holidays

      Comment


      • #4
        eurostoxx
        You are welcome and Happy Holidays to you too
        Alex


        Originally posted by eurostoxx
        thanks so much alexis Montenegro... i was reading through some of your posts on this forum and I just wanted to thank you for being a real helpful chap..

        would you be interested in doing a little custom work, for a fee of course. Maybe 5-10 hours work to start

        if so send me a msg: [email protected]

        happy holidays

        Comment

        Working...
        X