Announcement

Collapse
No announcement yet.

Strategy.xxxxxxx() problems - basic.

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

  • Strategy.xxxxxxx() problems - basic.

    Hi all,

    being fairly new to eSignal backtesting (though far from new to JS and programming), I hope someone will indulge me and point me in the right direction.

    I have done a simple Kelner band type strategy - not in any hope of big cash rewards, but rather to try out the backtesting facilities - but am having problems with the buy and sell commands - or maybe the isLong and isShort booleans.

    For every entry, I use:
    Strategy.doLong("Enter Long", Strategy.CLOSE, Strategy.THISBAR);
    or
    Strategy.doShort("Enter Short", Strategy.CLOSE, Strategy.THISBAR);

    For exit, I use a check on:
    if (Strategy.isLong())
    or
    else if (Strategy.isShort())
    followed by:
    Strategy.doSell("Exit Long", Strategy.Close, Strategy.THISBAR, Strategy.ALL);
    or
    Strategy.doCover("Exit Short", Strategy.Close, Strategy.THISBAR, Strategy.ALL);
    respectively.

    I have included the full file, should anyone care to look, though suffice to say that the logic works fine.
    (I have confirmed this by using my own flags instead of isLong or isShort booleans; likewise inserted shapes in place of doLong and doShort - and all signals are then given correctly.)

    I think it must be a simple matter of me not using the Strategy functions and properties correctly, as running the backtest file as a normal formula, it looks like part of the chart is not being assesed (which is visible by the return values are connected by straight lines between signals as opposed to the proper values). Again, this does not happen when using shapes instead.

    Any help will be appreciated. Thanks in advance.

    CJ
    Attached Files

  • #2
    C-J
    In lines 84 and 106 replace Strategy.Close with Strategy.CLOSE
    Alex

    Comment


    • #3
      Originally posted by Alexis C. Montenegro
      C-J
      In lines 84 and 106 replace Strategy.Close with Strategy.CLOSE
      Alex
      Alex, good catch.

      Thank you kindly!

      CJ

      Comment

      Working...
      X