Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automatic contract size calculator based on risk% and interactive stop loss

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

    Automatic contract size calculator based on risk% and interactive stop loss

    Hey everyone!

    I'm new here, just migrating to NinjaTrader from Metatrader. Loving the platform so far, but I'm missing something that was very essential to my trading style (scalping on the 1 min).

    I'd like to code something similar to this: https://www.earnforex.com/metatrader...osition-Sizer/
    It's a free position size calculator for the Metatrader platform which automatically calculates your lot/contract size in real time based on an input risk% of your account balance and an interactive stop loss level that you can drag on the chart. (The program does a lot more that this, but to keep things simple that's the gist of it.)

    Honestly if I could create something where there's an interactive stop loss level that just displays a contract size based on a customizable risk% input... I'd be happy. It seems like a very simple thing to code but since I'm new to the script language, I don't even know where to begin.

    Can someone with experience offer some guidance? Is it even as simple as I imagine?


    #2
    Hello aronstrades,

    Welcome to the forum!

    Please read through this forum post on getting started with NinjaScript:
    https://forum.ninjatrader.com/forum/...040#post786040

    You can access account level items, like account balance, using .Get() and AccountItem.

    Account -https://ninjatrader.com/support/help...ount_class.htm
    .Get() - https://ninjatrader.com/support/helpGuides/nt8/get.htm
    AccountItem - https://ninjatrader.com/support/help...ccountitem.htm

    You can set your stop loss using SetStopLoss() based on your custom risk calculation.

    SetStopLoss() - https://ninjatrader.com/support/help...etstoploss.htm

    For user inputs, you can define them in the 'Input Parameters' menu of the NinjaScript Wizard.

    https://ninjatrader.com/support/help.../ns_wizard.htm

    Please let me know if you have any other questions.

    Comment


      #3
      Originally posted by aronstrades View Post
      Hey everyone!

      I'm new here, just migrating to NinjaTrader from Metatrader. Loving the platform so far, but I'm missing something that was very essential to my trading style (scalping on the 1 min).

      I'd like to code something similar to this: https://www.earnforex.com/metatrader...osition-Sizer/
      It's a free position size calculator for the Metatrader platform which automatically calculates your lot/contract size in real time based on an input risk% of your account balance and an interactive stop loss level that you can drag on the chart. (The program does a lot more that this, but to keep things simple that's the gist of it.)

      Honestly if I could create something where there's an interactive stop loss level that just displays a contract size based on a customizable risk% input... I'd be happy. It seems like a very simple thing to code but since I'm new to the script language, I don't even know where to begin.

      Can someone with experience offer some guidance? Is it even as simple as I imagine?
      Oh finally someone! Coming from Metatrader to Ninjatrader I feel I've returned to the year 1900. A dismal third party monopoly and exaggerated pricing for trade managers. My MetaTrader trade manager is considered magic in comparison.
      Have you found any solution?​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      577 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 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
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X