Announcement

Collapse
No announcement yet.

Plots Off on Chart?!?!?! Oh good gracious

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

  • Plots Off on Chart?!?!?! Oh good gracious


    Been getting some funny results so I decided to do a side by side compairson on $PLAYBACK. Below are two charts with the exact
    same study applied. One is applied to the chart DIRECTLY and the other is applied by using efsExternal inside of
    (etBarState() == BARSTATE_NEWBAR from another bare test study. I did this bare and quickly just to see. if I could find out what was going on.

    So the applied study on the right s just an exact copy with setSomputeonClose. The study on the right plots DIFFERENTLY? Shouldn't they
    be the same. Isn't computeonclose the same thing as telling your efs to only run on BARSTATE_NEWBAR? If no, is there any way to
    fix them so they do plot the same. They both should be plotting on candle closes/newbars. things that make you go Hmmmmmm


  • #2
    Geoff

    So the applied study on the right s just an exact copy with setSomputeonClose. The study on the right plots DIFFERENTLY? Shouldn't they be the same?
    Not necessarily as that will depend on what you are returning at every instance of BARSTATE_NEWBAR.
    If for example you were returning a moving average then at every instance of BARSTATE_NEWBAR you would need to retrieve the value of the average at the bar that just closed ie at bar index -1. As you return that value on bar index 0 the average will be offset forward by 1 bar when compared to the plot returned by an efs running with setComputeOnClose().
    If on the other hand at every instance of BARSTATE_NEWBAR you return the value at the current bar then by the time that bar is completed that value will no longer be correct because it represents what the value was on the first tick of that bar only.

    Isn't computeonclose the same thing as telling your efs to only run on BARSTATE_NEWBAR?
    It is in the sense that the section of code enclosed in a BARSTATE_NEWBAR statement will execute on the first tick of a new bar in the same way setComputeOnClose() executes the whole script on the first tick of a new bar.
    Howver they are different in that setComputeOnClose() executes on bar index -1 whereas BARSTATE_NEWBAR is executing at bar index 0.
    Alex

    Comment


    • #3
      Happy options expiration day.

      I think I understand. If I edit my study to utiltlize barindex -1 that may be more accurate in the long run. Thanks for the reply!

      Comment

      Working...
      X