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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      152 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      87 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      131 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      106 views
      0 likes
      Last Post CarlTrading  
      Working...
      X