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

Getting Position in Strategy in Different Timeframe

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

    Getting Position in Strategy in Different Timeframe

    Hi,

    How do I get my current position that was not bought or sold by that strategy? I have the same strategy running in different chart, 1 Minute and 5 Minutes. 5 Minutes strategy bought a share, and sent a profit limit order and a stoploss. Now the 1 Minute strategy is sending sell order. After my position is flat, it is still sending limit and stop loss orders and the 5 Minute strategy also still have pending orders. How do I determine my positions even if it is not performed by that strategy?

    Thanks.

    #2
    hello keyzclaire,

    Thanks for your post.

    Strategies are only able to see orders placed by that specific instance of the strategy. Note that strategies also cannot see manually placed orders or orders placed by another strategy.

    Please review this forum thread for information about running two NinjaScript strategies on the same account and same instrument: https://forum.ninjatrader.com/forum/...660#post792660

    You could consider modifying the strategies to check if the account position is flat before placing an order if you only want the strategies to submit orders when your account is in a flat position.

    PositionAccount.MarketPosition == MarketPosition.Flat would be used to check if your account position is flat before submitting orders.

    See the help guide documentation below for more information about PositionAccount.MarketPosition and sample code.

    PositionAccount: https://ninjatrader.com/support/help...etposition.htm
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,404 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    95 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    7 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    159 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    8 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X