Announcement

Collapse
No announcement yet.

Calculate Bar Midpoint

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

  • Calculate Bar Midpoint

    SUMMARY: I see a lot of questions on the boards here with people asking for the most mundane of code samples, those that may easily be found elsewhere, however, I feel as though I have exhausted myself searching the Forums, and the EFS Library, and the hours I have messed around with it in eSig, so thanks in advance.

    This may seem rudimentary, however, the context in which I am trying to utilize it is the key:

    GET TO THE POINT:

    if(!Strategy.isLong()) Strategy.doLong("Entry Long", Strategy.CLOSE, Strategy.THISBAR);

    Rather than the calculating only the close price, I want to calculate the midpoint between this bar's OPEN and CLOSE.

    EXCUSES, EXCUSES:

    I know that (H-L/2) will calculate the average bar price, but I need a slice of code that calculates the midpoint of the bars for backtesting, for example - Strategy.THISBAR and Strategy.NEXTBAR will only calc the open or the close (MARKET and CLOSE, respectively.) I just want to calc the midpoint of the bar for my executions system, sort of an average price calculation for each MA crossover. There has to be an easier way to do this. Again, thanks in advance.

  • #2
    400+ views, and nobody has anything? That says to me that this is more important than just a mindless question. C'mon, people, somebody step up here . . .

    Comment


    • #3
      Duh.

      midpoint( nLength [, Series | sym() | inv() ][, nBarIndex ] )

      P.S. This is what happens when you have a shortcut to ONLY the product KB, not the EFS KB!!!

      Comment

      Working...
      X