Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"global" stop loss

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

    #31
    Hello dafonseca,

    I have created a video to demonstrate that orders placed from a strategy to 3 different instruments will reflect in chart trader for those instruments.

    http://screencast.com/t/9poxsRM1

    Profit and loss for each open position will be shown in the Positions tab of the Control Center.

    Profit and loss for all closed trades is shown in the Account Performance tab of the Control Center.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #32
      Should this part be inside onBarUptade. method? or out side.

      Comment


        #33
        Hi dafonseca,

        The DailyLossLimit example only demonstrates limiting the loss for one instrument. The logic would need to be changed to work with multiple instruments.

        This was just an example to demonstrate accumulating profit and loss from both open positions and close trades.


        The code that I have used for the video was in OnBarUpdate and OnExecution.
        The code for the sample script is in OnBarUpdate and OnPositionUpdate.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #34
          I see your point. Let me ask you this:

          Does a stop loss and exitLong and ExitShort have the same "name" as the original order which open one position?

          In this case I could try to check each asset.

          Another question where can I further research this:

          foreach (Account acct in Cbi.Globals.Accounts)
          {
          if (acct.Positions != null)
          {
          // print information about each position
          PositionCollection positions = acct.Positions;
          foreach (Position pos in positions)
          {
          Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
          }
          // print information about each order
          OrderCollection orders = acct.Orders;

          foreach (Order ord in orders)
          {
          Print(ord.ToString());
          }
          }
          }

          Comment


            #35
            Hello dafonseca,

            The exit name will be whatever signal name it is given:
            ExitLong(string signalName, string fromEntrySignal)

            The fromEntrySignal will need to match the signalName of the entry order.


            The code you have posted checking the account position, is unsupported code and is not documented (because it is not supported).
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            576 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