Announcement

Collapse
No announcement yet.

Lot size - bug?

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

  • Lot size - bug?

    All,

    I’ve been doing some work with position sizing. I have been using the standard:

    var nLot = Math.round(Strategy.getPositionSize()/2);

    I have found this code in a number examples on this forum.

    I’m having a little problem with this code. I’ve been trying to simulate 2 contracts – i.e. setting the Lot size to 2 before the backtest begins. I was my strategy wasn’t exiting ½ the position when it was supposed to, so I did some debugging Printlns on this. The Lot size doesn’t appear to half if the number of lots is 4 or below? Has anyone else found this? Could someone from Esignal please comment?

    Excerpt from code:

    debugPrintln("Strategy.getPositionSize() = "+ Strategy.getPositionSize());

    var nLot = Math.round(Strategy.getPositionSize()/2);

    debugPrintln("nLot = "+nLot);

    Strategy.doCover("Paid for Stop", Strategy.STOP, Strategy.THISBAR, nLot, paidstop_num);


    Kind regards,

    Dan

  • #2
    Dan,

    From what we can see the syntax is correct and this snippet of code should work.

    Others viewing this thread might be able to provide you with additional support if you would post your code to this forum.

    AveryH
    eSignal Support

    Comment


    • #3
      Avery,

      Thanks very much for your reply.

      Kind regards,

      Dan

      Comment


      • #4
        Hi Dan,

        I thought I'd provide you with a bit more information of where to find additional assistance. eSignal does not have the resources to provide one-on-one private support for EFS users, however, we do value our clients and EFS users and have provided the following sources to assist them:
        We have a wonderful EFS developer community, but in case you don't receive an answer to this inquiry I invite you to contact one of our experienced EFS Developer Partners.

        Thank you for choosing eSignal!
        Todd Gafford | Developer Support and API Product Manager | Interactive Data Desktop Solutions
        3955 Point Eden Way, Hayward, CA 94545

        Comment

        Working...
        X