Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get account submitted or opened positions

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

    Get account submitted or opened positions

    Hello,

    I have program a strategy that use a function to adjust position size according to margin by contract requirement of the instrument.

    i got 3 strategies running on 3 different instruments
    I would like to adjust position size if there is submitted orders or opened positions in one or two of the others intruments.
    So I would calculate the margin used and remaining to re adjust position size.


    Can I do something like this :

    If the strategy trade the USOIL and there is an order or position on the US3O

    // Check for other orders or opened positions by other Algos
    if (PositionAccount.MarketPosition != MarketPosition.Flat || if there is submitted orders in instruments differents than USOIL ){
    if (PositionAccount.Instrument.MasterInstrument.Name == "@US30") {
    // I will calculate used margin here to retract it from avalaible capital

    }
    // And will do the same for the third instrument

    }



    Thanks for the help

    #2
    Hi algoroman, thanks for posting.

    The best thing to do would be to add the other instruments with AddDataSeries() and manage everything from one strategy. If that is not possible, you will need to set up an Addon style Account object and subscribe to its ExecutionUpatate/PositionUpdate events to get an event when any order happens on the account:



    Kind regards,
    -ChrisL

    Comment


      #3
      Thanks a lot for your help.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X