Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Feasibility of creating position size calculator?

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

    Feasibility of creating position size calculator?

    Hi gang. I'm coming from the CFD world where Metatrader4/5 is the king platform.

    There are TONS of trade execution & management tools available for MT that make opening positions with proper risk a breeze.

    I've spent some time searching for similar tools for NT8 and what I've found is beyond woeful compared to what I'm used to, particularly for those who trade market orders like I do. This makes me wonder if it's possible at all.

    I've coded my own MT4/5 custom trade management tool a'la Magic Keys, and I'm trying to figure out if anything like this, or even this, is possible in NinjaTrader.

    I've spent a few minutes looking through the code documentation, but maybe someone familiar with the NT function library can help me figure this out more quickly.

    From what I can tell these things are possible via scripting in NT8:
    • Placing horizontal lines that can then be moved by a user
    • Accessing the price value of those lines and passing them to a variable
    • Creating buttons on the chart that a user can click, triggering code within script
    Is this all correct?

    It seems like the order execution and management would be done within a 'strategy', right? Does a strategy have the ability to do the above things? Or can only indicators create, manipulate, and access the values of charted objects?

    Also, can keystrokes be received, triggering code within the script?

    Any help simply confirming or denying the viability of this project would be much appreciated. If it is I'm happy to put the time required into coding it. If not I don't want to waste my time on a dead end road.

    Thanks!
    Last edited by rrsch; 01-11-2024, 10:42 PM.

    #2
    Hello rrsch,

    Welcome to the NinjaTrader forum.

    This forum post has references links and videos that may be helpful on getting started with NinjaScript:



    Yes, as long as you have logic in your script to prevent the drawing object from being updated once it has been drawn, the user should be able to move it manually.

    You can then access DrawObjects collection and loop through it to find a specific drawing object, and use it's anchor property and price property to get the price information. For a horizontal line, you could use yourObjectsVariable.StartAnchor.Price.

    DrawObjects - https://ninjatrader.com/support/help...rawobjects.htm


    You can also create custom buttons. Please see the sample wpf modifications script that demonstrates adding custom buttons to chart:


    This Ecosystem User App Share script also demonstrates using buttons which you may find helpful.
    https://ninjatraderecosystem.com/use...bar-buttons-2/

    You can detect keystrokes through code in your script. Please see this forum post which has an example demonstrating handling key presses:



    If you have any further questions, please let me know.

    Comment


      #3
      Thanks Gaby, much appreciated. I'll dig in.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X