Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Position for a particular instrument

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

    Market Position for a particular instrument

    I have a basic strategy that I am running on four different instruments. I do this because the result of running all four instruments with slightly different variations of the same strategy smooths the account equity curve. Since this is a multiple exit strategy I find that if I limit the entries to occur only when the strategy is flat, my performance improves. However I am running the same strategy on four different instruments in the same account so that when I check to see if the account is flat, there is some chance one of the other strategies is not flat so I will not get the entry that should occur. Is there a way to check if the account is flat only for a particular instrument, so that I can still maintain the strategy independence that I get when I test a single strategy running in a single account, with nothing else running?
    Thanks
    DaveN

    #2
    Hello DaveN,

    You can't check an account position. The strategy position can be checked for other instruments in the series. This only applies for the specific strategy context you're working from.

    You use Positions[x] , where x is the series index.

    if (Positions[1].MarketPosition == MarketPosition.Long)
    Print(Positions[1].MarketPosition.ToString());
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Market Position cont

      So when I test if a strategy is flat or not, it only recognizes the instrument that strategy is running on anyway. So I could have the same strategy running on the ES and the TF in separate charts, and if the TF strategy is flat, but the ES is short or long, when I do the test from within the TF strategy it will see the result as flat so it will launch the trade on the TF, irregardless of whether I have a position open on the ES or not? I realize I may be beating a dead horse here but I just want to be sure that I understand how it works.
      Also I'm not sure what you mean by using Positions. I think that applies to multiple instruments in a single chart. I am running separate strategies on separate charts so Positions[X] doesn't apply right?
      Thanks
      DaveN

      Comment


        #4
        So I could have the same strategy running on the ES and the TF in separate charts, and if the TF strategy is flat, but the ES is short or long, when I do the test from within the TF strategy it will see the result as flat so it will launch the trade on the TF, irregardless of whether I have a position open on the ES or not?
        Yes, that's correct. The strategy is not aware of positions opened on another chart, even if using the same named stategy. They're considered separate strategy instances and are independent from each other.

        I think that applies to multiple instruments in a single chart. I am running separate strategies on separate charts so Positions[X] doesn't apply right?
        Correct - Positions[x] can't read the position from another strategy instance and would only apply to multiple series strategies.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Market Position cont

          Thanks Ryan,
          I appreciate the extra effort to make sure I understand.
          DaveN

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rtwave, 04-12-2024, 09:30 AM
          4 responses
          29 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Started by yertle, Yesterday, 08:38 AM
          7 responses
          28 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by bmartz, 03-12-2024, 06:12 AM
          2 responses
          21 views
          0 likes
          Last Post bmartz
          by bmartz
           
          Started by funk10101, Today, 12:02 AM
          0 responses
          6 views
          0 likes
          Last Post funk10101  
          Started by gravdigaz6, Yesterday, 11:40 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X