Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks a lot for your help.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DJ888, Today, 10:57 PM
      0 responses
      1 view
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by MacDad, 02-25-2024, 11:48 PM
      7 responses
      158 views
      0 likes
      Last Post loganjarosz123  
      Started by Belfortbucks, Today, 09:29 PM
      0 responses
      7 views
      0 likes
      Last Post Belfortbucks  
      Started by zstheorist, Today, 07:52 PM
      0 responses
      7 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      151 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Working...
      X