Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding to a position

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

    Adding to a position


    I was wondering if someone can post an example of how to scale into an existing position. I have searched the forums and other sites that use C# for an example of how to add to a position that is already open. It doesn’t matter what you use to enter or eixt, I just need a format to follow as I am a new to coding and learn best through example and it might help other people on the forum as well. If now one can, I understand as it looks like it is a pain to write the code for it.
    I have already looked at using OnExecution() and IOrder for entering another position based on the ATR with no luck.

    #2
    Create a new strategy via wizard, unlock it so you are in the NinjaScript Editor.

    Add the following code to OnBarUpdate():

    if (Close[0] > Open[0]) EnterLong();

    Now run a backtest on a 1 minute chart with exit on close set to true and change the "Entries per direction" value from 1 to 2, then to 3. Take a look at your back test results, look at the chart.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray.
      I will mess around with this some more and see if I can get it to work with ATR.

      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