Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Programmatically set trade size in discretionary trading

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

    Programmatically set trade size in discretionary trading

    Hello, I would like to know if there is a way (any kind of way, from setting parameters to coding a platform extension) to accomplish a simple task.

    I would like to:

    1) on a stock chart, manually enter an order to open a position, with an ATM strategy already selected and active

    2) override the trade size by invoking some code that, before sending the order to the broker, changes the order size according to some logic (e.g. calculating number of shares based on current volatility)

    Is this possible?

    Thank you.

    #2
    Hello barabba,

    If the script itself was placing the orders (via button press or other action) this would possible to achieve as the script could set the quantity before the order is placed.


    However, I am not aware of a way to stop an order from being placed so that it may be modified.

    The Account tools would allow to for a trigger any time an order is placed or the position changes etc, but this would be after the order is already submitted. You could send a ChangeOrder() for the existing order after its been placed.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I'm experimenting with the strategy script you provided in your previous message. The script places two buttons on the chart, and it is good to open manual trades with calculated number of shares.

      The problem is that this strategy script is no longer active when I close and reopen ninja trader. I have a 4k monitor with more than 30 charts opened, and I have to manually reactivate the strategy on each chart each time ninja trader is restarted.

      Is there a way to keep the strategy active between ninja trader restarts?

      Comment


        #4
        Hello barabba,

        No, there is not a way to have a fully automated NinjaScript Strategy automatically enable itself and start trading when starting NinjaTrader.

        You could make an indicator that has the same functionality using an account object to generate the order. This would be more complex to achieve.




        Below is an example that is in an Addon, though the code that actually sends the order (the Atm Strategy part being optional) would be the same.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you for your answer. I'll try with an indicator.

          However, I'm surprised to hear that automatic strategies always have to be enabled manually... is this what algorithmic traders do? Where is the "automatic" of automation?

          Even in that simple MT4 platform it's possible to keep strategies active between restarts. I believe this should be a trader's choice.

          Comment


            #6
            Hello barabba,

            The automation comes from the entries and exits that are controlled by code instead of semi automated the way Atm Strategies require a manual order to begin working.

            I have submitted a feature request on your behalf for the NinjaTrader Development to consider allowing strategies to automatically become enabled upon connection in a future version of NinjaTrader.

            Once I have a tracking ID for this request I will forward this to you for future reference.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello barabba,

              I have received a tracking ID for your request.

              For future reference, your request to for NinjaTrader to re-enable strategies on startup which were enabled at the time of the last shut down is being tracking with ID #SFT-937.

              Please note it is up the NinjaTrader Development to decide if and when a request will be implemented.

              Thank you for your feedback. Please let me know of any other suggestions you have for the NinjaTrader platform.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DJ888, 04-16-2024, 06:09 PM
              4 responses
              12 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by terofs, Today, 04:18 PM
              0 responses
              8 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by nandhumca, Today, 03:41 PM
              0 responses
              6 views
              0 likes
              Last Post nandhumca  
              Started by The_Sec, Today, 03:37 PM
              0 responses
              3 views
              0 likes
              Last Post The_Sec
              by The_Sec
               
              Started by GwFutures1988, Today, 02:48 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X