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

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.
    Gaby V.NinjaTrader Customer Service

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,788 views
      0 likes
      Last Post aligator  
      Started by Jimmyk, 01-26-2018, 05:19 AM
      6 responses
      837 views
      0 likes
      Last Post emuns
      by emuns
       
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,293 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      12 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      11 responses
      62 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X