Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    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 Leeroy_Jenkins, Today, 06:35 AM
      0 responses
      6 views
      0 likes
      Last Post Leeroy_Jenkins  
      Started by moneyexe, Today, 01:38 AM
      3 responses
      21 views
      0 likes
      Last Post bltdavid  
      Started by EmmaaPerkin, Today, 12:29 AM
      0 responses
      9 views
      0 likes
      Last Post EmmaaPerkin  
      Started by appleacv, Today, 12:17 AM
      0 responses
      8 views
      0 likes
      Last Post appleacv  
      Started by ReingerJamir, Yesterday, 10:51 PM
      0 responses
      14 views
      0 likes
      Last Post ReingerJamir  
      Working...
      X