Announcement

Collapse
No announcement yet.

Series Question

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

  • Series Question

    Hi,

    I am trying to write a script that would plot a series. The issue here is the following:

    Lets say I have 100 bars on the chart and am currently on bar 0. If I loop through all the historical bars (-1 to -99) and calculate a value y1 and y2, I will have 100 different y1 and y2 values. I can then calculate the sum y3 = y1+y2 to get 100 y3 values. If I were to draw these y1, y2 and y3 values, on their respective historical bars, I would get a plot that would update on each new bar. How would I do this using a series? The issue is that I am not sure how to build a series from an array of values that changes on each new bar. Any suggestions would be greatly appreciated. Thank you very much.
    Regards,
    Jane

  • #2
    Re: Series Question

    Hi Jane,

    Originally posted by jg
    Hi,

    I am trying to write a script that would plot a series. The issue here is the following:

    Lets say I have 100 bars on the chart and am currently on bar 0. If I loop through all the historical bars (-1 to -99) and calculate a value y1 and y2, I will have 100 different y1 and y2 values. I can then calculate the sum y3 = y1+y2 to get 100 y3 values. If I were to draw these y1, y2 and y3 values, on their respective historical bars, I would get a plot that would update on each new bar. How would I do this using a series? The issue is that I am not sure how to build a series from an array of values that changes on each new bar. Any suggestions would be greatly appreciated. Thank you very much.
    Regards,
    Jane

    It doesn't sound like you have taken a look at the tutorial-like threads that Alex put together that explained how to use EFS2. I believe there is at least one example in these threads that may be readily tweaked to manipulate series objects and their values like you described.

    Check out the links that pertain to EFS2 in my signature block below. (There are links to the Knowledgebase and Glossary as well.) Once you have put together an efs from the example code in those threads, please; 1) post your working code as a nice conclusion to the thread or 2) post your code so that we can troubleshoot any problems you are having such that we can get to 1)...

    Hope this helps.

    Comment


    • #3
      Re: Re: Series Question

      Hi Steve,

      Thank you very much for the references. I will study them thoroughly. I do have some familiarity with efs programming and I do have a code. The issue for me is that up until now I have always created a series from the calculation of a single resulting value at each bar. So, at each bar I would loop through bars and calculate a single value result. I would then construct a series using those results. The issue, is that I have 259 values at each bar. These values actually are the points of the series that needs to be plotted. The step I am missing is how do I get the calculated 259 values to be recognized as the series so that it can be plotted? I hope I am making myself clear. Please forgive me for being obtuse but here is a clearer example,

      At each bar I calculate the values for all the bars. Say I only have 5 bars on the chart. At bar zero I will calculate the values 4.0, 4.1, 4.2, 4.3, 4.4, one for each of the bars on the chart. These are the values that need to be plotted. These are also the values of the series at those bars; i.e.
      mySeries.getValue(-4) = 4.0
      mySeries.getValue(-3) = 4.1
      mySeries.getValue(-2) = 4.2
      mySeries.getValue(-1) = 4.3
      mySeries.getValue(0) = 4.4
      My issue is the transition step; that is, how do I tell the program that the calculated values are in fact the mySeries.getValue(bar index) values. I hope this has clarified my problem a bit more clearly. Thank you very much for any help or suggestions you may be able to offer.
      Regards,
      Jane


      Originally posted by stevehare2003
      Hi Jane,




      It doesn't sound like you have taken a look at the tutorial-like threads that Alex put together that explained how to use EFS2. I believe there is at least one example in these threads that may be readily tweaked to manipulate series objects and their values like you described.

      Check out the links that pertain to EFS2 in my signature block below. (There are links to the Knowledgebase and Glossary as well.) Once you have put together an efs from the example code in those threads, please; 1) post your working code as a nice conclusion to the thread or 2) post your code so that we can troubleshoot any problems you are having such that we can get to 1)...

      Hope this helps.

      Comment

      Working...
      X