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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      152 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      305 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      345 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      176 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X