Announcement

Collapse
No announcement yet.

Strategy. Number of Contracts ??

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

  • Strategy. Number of Contracts ??

    when creating a Strategy that will run in backtest, how would i specify the strategy.isShort / Long lines so that i can enter with 2 Contracts and exit with 1 Contract at one target and the last Contract at the second target

    i have tried the following which does not work,


    function main(Contracts) {

    var Contracts = 2;



    Strategy.doLong("Crossing Up", Strategy.CLOSE, Strategy.THISBAR,Contracts);


    Strategy.doSell("Sell1", Strategy.CLOSE, Strategy.THISBAR,Contracts/2);

  • #2
    well what a plonker , it helps if you click the save Formula button, the multiple contracts is now working but the edit contracts is not , anyone got any ideas ?

    Comment


    • #3
      shogun
      Try replacing var Contracts = 2 with the following
      if(Contracts==null)Contracts=2;
      Then remove the efs from the chart and load it again
      Alex

      Comment


      • #4
        shogun,

        Yes, you are not alone . The periodic non-use of the save Formula button is, for me at least, a continual source of consternation. It has become one of the first things I check anymore after my edits fail to solve the problems at hand.

        the multiple contracts is now working but the edit contracts is not
        The problem you are having is not clear, can you offer some clarification?

        Comment


        • #5
          alex that works fine thanks ,

          steve what can i say

          Comment

          Working...
          X