Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accumulated contracts in each order

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

    Accumulated contracts in each order

    Hello friends of NT
    I dont understand where is the error but my strategy accumulated 1 contract in each order when i test it in replay. But dont happend when I reload the chart...

    The code lines for launch orders are very simple:


    void myLong(){
    if (Position.MarketPosition == MarketPosition.Flat || Position.MarketPosition == MarketPosition.Short){
    EnterLong(OrderQuantityVar,"L");
    }
    }
    void myShort(){
    if (Position.MarketPosition == MarketPosition.Flat || Position.MarketPosition == MarketPosition.Long){
    EnterShort(OrderQuantityVar,"S");
    }
    }


    The "OrderQuantityVar" value is always 1 in the output window.

    My NT version is the last (7.0.10.30)

    Look the animated gif below please. Thank you.


    Last edited by ninjo; 09-13-2015, 07:43 AM.

    #2
    Hello,

    Thank you for the question.

    I would like to ask, what is your CalculateOnBarClose set to and also what is the strategies "Entries per direction" and "Entry Handling" configured as?

    This could possibly be one of those settings but I would need further information to determine what may be causing the extra orders.

    I look forward to being of further assistance.

    Comment


      #3
      Hi Jesse

      "CalculateOnBarClose"= true

      "Entries per direction" = 1

      "Entry Handling" = AllEntries
      Last edited by ninjo; 09-15-2015, 04:14 AM.

      Comment


        #4
        Jesse? Hi .. ?

        Comment


          #5
          Hello,

          Thank you for the reply.

          This could be due to the logic used in the script, based on the settings I would not expect the result unless CalculateOnBarClose is set to false, or if the Entries Per Direction was greater than 1, or if there was a secondary series in the script which the orders are submitted that is of finer granularity.

          Would you be able to provide either the script or a sample of the logic used that demonstrates this? I would need to see the logic used further in order to understand what may be happening, otherwise you would likely need to use Prints to see when the conditions to submit orders are occurring to check if it is not what is expected, check the values being passed to the order methods etc.

          I look forward to being of further assistance.

          Comment


            #6
            Hi Jesse, thanks.

            No aditional data series in my strategy
            It have an added indicator, but indicators cant launch orders.

            Its very strange because i am printing this line into the functions:

            Print("Order at : " + Close[0].ToString() + " Contracts: " +OrderQuantityVar );

            and the line printed never is repeated, and the OrderQuantityVar is 1 always
            I m very confused

            Comment


              #7
              Hello,

              Thank you for the reply.

              I am unsure what could be the cause based on the information provided, I would likely need to be able to reproduce this on my end to see the problem.

              If you are able to create a sample that you can provide for testing I could look into this further, I would need a sample and the instrument and timeframe used in the image, and any other settings to re produce what you are seeing.

              I look forward to being of further assistance.

              Comment


                #8
                Hello Jesse,
                Now works !

                The error was that a ExitLong() and ExitShort() funcition was called after EnterOrders functions.
                A very strange case, because the logic tell me that the strategy could exit of order, not acummulate contracts..

                Nolse, the problem was solved removing ExitLong() and ExitShort() from my program.

                Thank you for your patient Jesse.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                633 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                364 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                567 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                568 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X