Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do prevent selling of our position on the same day that it was opened?

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

    How do prevent selling of our position on the same day that it was opened?

    I want my automatic trading strategy to not close a position on the same day that it was opened. How do I do this?

    Thanks

    Tom

    #2
    Tom, for this you would need to set ExitOnClose in the UI to false when running or backtesting your strategy -

    http://www.ninjatrader-support.com/H...romAChart.html

    http://www.ninjatrader-support.com/H...AStrategy.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      ExitOnClose "Indicates if the strategy will cancel all strategy generated orders and close all open strategy positions at the close of the session."

      This is not what I want to do. I only want the open order to execute no more than once per day and for sell order to not execute on the same day the open order was executed. Also I want to control this programatically.

      Comment


        #4
        Tom, thanks for clarifying - you would then need to control this via a boolean flag included in your trade entry conditions that you reset each day to allow for new trades to be taken.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Look in the Help Guide for 'IExecution', there is a 'DateTime' property that you can use in your boolean trade logic conditional statements.

          Comment


            #6
            Thanks looks like that will work.

            Looks like you get the iExecution variable passed in on OnExecution. Can I save that to a global variable at that time and reference it later?

            Another related question. Is there a new instance of the strategy running for each equity it is monitoring? In other words, if I save iExecution to a global variable, will it affect any other equities I'll be monitoring with the same strategy?

            thanks

            Comment


              #7
              Tom, yes you could save values returned to a custom variable.

              Correct, this would only refer to the individual strategy instance, as NinjaScript strategies do not cross communicate.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by mballagan, Today, 01:02 PM
              0 responses
              3 views
              0 likes
              Last Post mballagan  
              Started by larkmail, Today, 12:30 PM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by omermirza, Today, 12:39 PM
              0 responses
              9 views
              0 likes
              Last Post omermirza  
              Started by Danila, Today, 11:08 AM
              1 response
              11 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by dbida001, Today, 10:31 AM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Working...
              X