Announcement

Collapse
No announcement yet.

Help please, creating a new series.

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

  • Help please, creating a new series.

    I want a series, xSeries to be the points, one for each bar calculated from a formula.

    I am doing something like this but it is not working:

    ySeries = efsInternal (makeSeries, point);
    pointvalue = ySeries.getValue(-3);


    function makeSeries(point) {
    var xarray = new array;
    xarray = xarray.push(point);
    return xarray;
    }


    This is not working. Any help with what I should be doing is appreciated.

    jgr

  • #2
    I think it's because you keep recreating the array in your function.

    I believe the solution is something like this..

    PHP Code:

    var xarray = new array;
    var 
    ySeries;
    var 
    pointvalue;

    function 
    main(point) {
      if (
    point == null) { point 3;  }
       
    ySeries efsInternal (makeSeriespoint);
       
    pointvalue ySeries.getValue(-3); 
    }


    function 
    makeSeries(point) {
        
    xarray.push(point);
        return 
    xarray;

    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Doji3333,

      Thanks for the help. I will try this later when the market is closed.
      jgr.

      Comment


      • #4
        Thinking about this a little more over lunch - having decided this is a terrible day to trade. Each bar in a series apparently stores a value for each of:
        open,
        high,
        low,
        close,
        time,
        rawtime,
        volume,
        oi,
        year,
        month,
        day,
        hour,
        minute,
        second.

        SO: when efsInternal converts an array into a series, which of these values are populated with what? I am presuming that a one dimensional array, that the values are saved in the series as "close" values.

        Anybody have more on this? Thanks.

        Comment


        • #5
          in my opinion, you don't need to use efsInternal to create "common" series values. Open, high, low, close and many others are available directly within efs if you create a bar counter and "backtrack" to the bar you want.

          In other words, you don't need to do any of this "series" stuff unless you need to create and store "uncommon" values.

          Does this help?
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment


          • #6
            Doji3333,

            I understand. I am trying to create a series from my own calculated values. It would be a single line so only one value per bar is needed. Mostly I use the built in series but there is not one that does what I am trying.

            jgr

            Comment


            • #7
              jgr,

              efsInternal creates a series from values returned by the -return- statement in the internal function. It does not save the values as close, open, etc. It creates a separate series of just the values returned from the internal function.

              I hope I understood your question.

              Thinking about this a little more over lunch - having decided this is a terrible day to trade. Each bar in a series apparently stores a value for each of:
              open,
              high,
              low,
              close,
              time,
              rawtime,
              volume,
              oi,
              year,
              month,
              day,
              hour,
              minute,
              second.

              SO: when efsInternal converts an array into a series, which of these values are populated with what? I am presuming that a one dimensional array, that the values are saved in the series as "close" values.

              Anybody have more on this? Thanks.
              If you only need one value per bar and don't need to go back to previous values from your formula you can just call the function without the -efsInternal-. This way only one value will be returned and used in main() instead of a series.

              Doji3333,

              I understand. I am trying to create a series from my own calculated values. It would be a single line so only one value per bar is needed. Mostly I use the built in series but there is not one that does what I am trying.

              jgr
              Wayne
              Last edited by waynecd; 07-26-2009, 11:18 AM.

              Comment


              • #8
                Then you don't need a series or array (although they would be handy). All you need is to identify the "value/price" of your line with your custom calculation and return it from your MAIN function.

                I've found drawing lines is easy with the drawLineRelative function.

                drawLineRelative(-1,LineLevel,1,LineLevel, PS_SOLID, 2, Color.maroon, "Stplnx"+nBarCounter);

                This is what I use to draw profit targets and stops while Strategy.isInTrade(). Just change the TEXT ID at the end ("Stplnx") and place it in your MAIN function.

                You can draw as many lines as you like by changing the TEXT ID.

                If you need help, post some sample code and we'll all do our best to help.

                Basically, you need to select how you want to store data and what data to store. I've found creating arrays of objects can be a big help. You could have one bar (array item) store ALL data your system requires to operate (if it's simple).

                Hope this helps & thanks to Wayne for his help.


                Originally posted by jgr
                Doji3333,

                I understand. I am trying to create a series from my own calculated values. It would be a single line so only one value per bar is needed. Mostly I use the built in series but there is not one that does what I am trying.

                jgr
                Brad Matheny
                eSignal Solution Provider since 2000

                Comment


                • #9
                  A lot of good information here. I have to get back into thinking about this one.

                  This is what I was doing. There is a simple way:

                  function makeOSC(pseries,nseries) {
                  return (pseries.getValue(0) - nseries.getValue(0));
                  }

                  What happens if I have the series:

                  myseries = efsInternal (something);

                  If something returns a single value, then what do I get if I use:

                  var test = high(0,myseries);
                  Last edited by jgr; 07-26-2009, 04:35 PM.

                  Comment

                  Working...
                  X