Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ninja scripts that automatic calculate trading size

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

    Ninja scripts that automatic calculate trading size

    Hello, I am a client of Ninjatrader brokerage. I am looking for a Ninja scripts that automatic calculate trading size based on stop and specified risk limit per trade. For example, I am taking a short on the MES. I first place my stop at 4500 and I have a risk limit of 2% of my account or $500 dollar. Upon entering a short at 4495 with limit, market or stop order, I would like the Ninja script to automatically calculate and place trades with the appropriate size based on the stop and pre-defined risk level. Is it a way to do this? Sometimes it takes a long time for me calculate the right size and miss reasonable trades. Also, i am trading using Chart Trader. So I would like a Ninja script that works on Chart Trader.

    #2
    Hello Realiori9999,

    Thanks for posting your question here.

    NinjaScript strategies would be used for automated entries and exits. NinjaScript strategies are often meant to run without other trades being placed elsewhere to the same account/instrument, because the account position needs to be in sync with the strategy position in order for the strategy to make profitable trades. It is also possible to program a strategy that monitors the account position that works with additional manual trades, but we should consider the use of NinjaScript strategies for automated entries and exits.

    ATM strategies would be used for manual entries, where exits are automatically deployed and managed by the ATM strategy. ATM strategies cannot be used for percentages of the entire account, NinjaScript would be needed.

    It is also to build an AddOn that adds buttons to Chart Trader for manual entry that allow for completely customized behaviors.

    I think you would want to go the Addon route. This would involve:

    1. Adding a script to the chart, like an indicator, that modifies Chart Trader to add your custom buttons.
    2. The indicator should then add an Account object instance for your account
    3. The button within the indicator could then create and submit the entry order with Account.CreateOrder and Account.Submit
    4. The indicator can also subscribe to Account.OrderUpdate and Account.ExecutionUpdate events to detect when the entry order is submitted and filled.
    5. When the entry order is filled, you can use your events subscribed to Account.ExecutionUpdate to be able to place your stop loss at your desired levels

    Account.Get can be used to fetch AccountItems, like CashValue, so you can calculate stop loss levels that are relative to your account standing.

    Associated documentation on these items can be found below:An example that demonstrates making modifications to Chart Trader can be found here - https://ninjatrader.com/support/foru...considerations

    Le us know fi you have any questions.

    Comment


      #3
      Realiori9999 I saw your post on share size based on stop to always risk the same $500, this is exactly what I do and want to automate this process for a system I am working on. Did you every figure out if you can do this with ninjatrader 8? Thanks so much for your time. Ryan

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      62 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      134 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X