Announcement

Collapse
No announcement yet.

Is there an error trap for Strategy.doSell?

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

  • Is there an error trap for Strategy.doSell?

    When I execute a sell instruction, but I am not long (eg)
    Strategy.doSell("comment",Strategy.CLOSE,Strategy. THISBAR,1);
    it appears processing for that daily bar is abruptly discontinued for that bar. Is there an error trap routine in EFS which will allow me to gain control at the interruption?

    I did solve the problem by testing for Strategy.isLong()==true before executing the sell command - but would like to know if an error trap routine is available.
    Last edited by jcm21; 05-15-2008, 07:40 PM.

  • #2
    not that I'm aware of. What you have to do is write code to check if the SELL order you want to fire is valid. For example..

    If you wanted to sell at a certain price, then you have to check to see if the current bar "spans" the price you want to execute at.

    if ((high() >= mysellprice) && (low() <= mysellprice)) {
    Strategy.doSell("Se", Strategy.LIMIT, Strategy.THISBAR, 1, mysellprice);
    }

    BTW, the Strategy functions are designed to provide certain types of trade actions.

    Strategy.doLong() : Enters a LONG trade position
    Strategy.doSell() : Exits a LONG trade position

    Strategy.doShort() : Enters a SHORT trade position
    Strategy.doCover() : Exits a SHORT trade position
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thanks for your help

      Doji3333.

      Thanks. Much appreciated.

      Comment

      Working...
      X