Announcement

Collapse
No announcement yet.

Basic EFS plot help

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

  • Basic EFS plot help

    I am trying to plot 2 simple lines as a study (separate of main price chart). Have been through a ton of the studies trying to clone so as not to waste anyone's time. But no luck.

    Basically trying to plot 2 lines separate of main price chart.
    X and an EMA of X. Seems its not allowing me to send back either of the variables or my syntax is wrong for returning the values.

    Any help would be greatly appreciated. My Code is attached (its literally 5 line module
    Attached Files

  • #2
    Re: Basic EFS plot help

    canopas8
    The main reason your script is not working is because the variable X is a value and not a series which the ema() function instead requires.
    In order to do what you want you will need to first calculate X in a separate function (or efs) and then call that function or efs using either the efsInternal() or efsExternal() functions. This will create the series which you can then use as a source for the ema() function used to calculate AvgX
    For a more detailed explanation and solution see this post in reply to a similar question. In that reply you will also find links to other examples on creating studies on studies using efs2 functions
    Having said this you are essentially calculating a MACD and its Signal line so you may find it considerably simpler to use the MACD functions setting the parameters to 1, 30, 14
    Regardless of the solution you may implement the other error is that you are are not returning an array.
    To correct this replace return (X, AvgX); with return new Array (X, AvgX);
    Alex

    PS. When posting scripts please either attach the efs file rather than a text file or post your code in the body of your message using either the [ CODE } or [ PHP ] tags


    Originally posted by canopas8
    I am trying to plot 2 simple lines as a study (separate of main price chart). Have been through a ton of the studies trying to clone so as not to waste anyone's time. But no luck.

    Basically trying to plot 2 lines separate of main price chart.
    X and an EMA of X. Seems its not allowing me to send back either of the variables or my syntax is wrong for returning the values.

    Any help would be greatly appreciated. My Code is attached (its literally 5 line module

    Comment


    • #3
      Alexis: I am sincerely grateful for your taking the time to decrypt and resolve my problem.
      Your recommendation worked on the first go implemented in minutes what i had been wrestling to do for many hours.

      The only open issue: it currently plots as part of the price chart; since the Y-axis for the study is far away from the underlying price chart, i have 2 squished charts (price and my new study). How do i have ths study plot as a separately stacked subchart with its own y-axis the way built in studies seem to plot?

      Comment


      • #4
        canopas8
        You are most welcome.
        To resolve the problem replace the setPriceStudy(true) statement in preMain with setPriceStudy(false) or you can also delete the statement altogether since by default an efs will plot a study in its own pane
        Alex


        Originally posted by canopas8
        Alexis: I am sincerely grateful for your taking the time to decrypt and resolve my problem.
        Your recommendation worked on the first go implemented in minutes what i had been wrestling to do for many hours.

        The only open issue: it currently plots as part of the price chart; since the Y-axis for the study is far away from the underlying price chart, i have 2 squished charts (price and my new study). How do i have ths study plot as a separately stacked subchart with its own y-axis the way built in studies seem to plot?

        Comment


        • #5
          canopas8
          I forgot to add that after you made the suggested change you will need to remove the efs from the chart and then load it again
          Alex

          Comment


          • #6
            Alex: you've made my day. i struggled with this code and problem for an embarrassingly long time friday. Now up and running in minutes. Again my gratitude is incalculable!

            Comment


            • #7
              canopas8
              Again you are most welcome
              Alex


              Originally posted by canopas8
              Alex: you've made my day. i struggled with this code and problem for an embarrassingly long time friday. Now up and running in minutes. Again my gratitude is incalculable!

              Comment

              Working...
              X