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 f.saeidi, Yesterday, 02:09 PM
      3 responses
      18 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Jltarrau, Today, 05:57 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by kujista, Today, 06:23 AM
      0 responses
      2 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by traderqz, Yesterday, 04:32 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by f.saeidi, Today, 05:56 AM
      1 response
      5 views
      0 likes
      Last Post Jltarrau  
      Working...
      X