Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2 ninjascript strategies run independently?

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

    2 ninjascript strategies run independently?

    If I have 2 scripts running one is long the other short on the same instrument, I didn`t want them to offset eachother (close out the trade), as they both have their own stop loss and targets. is this possible with scripting?

    #2
    Hello jitterbug,

    Thank you for your post.

    Basic answer would be no, this is not possible. The strategies are managing their own internal account, they would not be able to know what position is currently being managed by another strategy or the account.

    However, you could use the undocumented account collection to pull information on the account the strategies are running on. For example:
    Code:
    foreach (Account acct in Cbi.Globals.Accounts)
    {
    if (acct.Positions != null)
    {
    PositionCollection positions = acct.Positions;
    foreach (Position pos in positions)
    {
    Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
    }
    }

    Comment


      #3
      Hi Patrick, not sure if I explained it right.
      basically are you saying if I have one ninjascript strategy opened long in instrument A, and open another NS strat short in instrument A that when the short is executed by the price the trade will be closed round trip and i`ll be flat?
      so you cannot hedge 2 separate open positions with their own stop losses with ninjascript..

      Comment


        #4
        I haven't tried but think of it from this perspective. How would your broker see it? He's just going to see buy and sells. So you'd be technically flat while your strategies have positions. I haven't tried this yet.

        Comment


          #5
          I get your point Sledge. Although MBtrading say they offer hedging ability where one trade doesnt offset another, and I recall being able to run concurrent trades in different directions a fair while ago either on MB`s platform as well as GCI, i`m actually surprised I cannot do this natively through ATS on NT.

          GCI hedging: Clients can open positions in the same instrument in opposite directions, without the positions offsetting and without using additional margin. Clients have complete control over whether they close or hedge their positions to reduce risk.
          as well as guaranteed stop executions (no slippage).

          anyway i`m surprised/disappointed that I can`t run multiple ATS concurrently on NT on a single instrument like this
          Last edited by jitterbug; 10-20-2015, 09:02 PM.

          Comment


            #6
            Originally posted by jitterbug View Post
            I get your point Sledge. Although MBtrading say they offer hedging ability where one trade doesnt offset another, and I recall being able to run concurrent trades in different directions a fair while ago either on MB`s platform as well as GCI, i`m actually surprised I cannot do this natively through ATS on NT.

            GCI hedging: Clients can open positions in the same instrument in opposite directions, without the positions offsetting and without using additional margin. Clients have complete control over whether they close or hedge their positions to reduce risk.
            as well as guaranteed stop executions (no slippage).

            anyway i`m surprised/disappointed that I can`t run multiple ATS concurrently on NT on a single instrument like this
            You can do it. The display position would show what you want, but of course the physical position will reflect the reality of being flat.

            Just use 2 different DOMs.

            ref: http://ninjatrader.com/support/forum...ad.php?t=50500

            Comment


              #7
              Thanks Osikani, they were helpful links I get how it works now.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              574 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              333 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