Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy using PositionAccount vs Strategy Position

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

    #46
    Hello DTSSTS,

    Thanks for your reply.

    I was suggesting using the simple example I provided and testing some of your code in there.

    What are the specific errors you see?


    Comment


      #47
      && (myAccount.Position.MarketPosition != myAccount.Positions.MarketPosition.Long)// HAD TO BLOCK BECAUSE OF ERRORS
      && (myAccount.Position.Quantity == 0)// HAD TO BLOCK BECAUSE OF ERRORS

      error is NinjaTrader.Cbi.Account does not contain a definition for 'Position' and no extension method 'Position' accepting a first argument of type NinjaTrade.Cbi.Account could be found

      i have every line of the code from you example in my indicator

      Comment


        #48
        Hello DTSSTS,

        Thanks for your reply.

        I think you are misunderstanding the example I provided. The example provides the market position and the quantity already you really don't need those lines in your post #48

        If I can suggest you may be at a point where you should hire a 3rd party programmer for this work.

        Comment


          #49
          I do hire 3rd party when is extensive and am able to describe what is needed (i have spent well over 10K with 3rd party.) but when you are testing and learning what is need that is just not possible. I have gotten engaged a few times for over 3 months trying to explain what is needed.

          it his case I just want to state

          && (myAccount.Position.MarketPosition != myAccount.Positions.MarketPosition.Long)// HAD TO BLOCK BECAUSE OF ERRORS
          && (myAccount.Position.Quantity == 0)

          i need to know that we are NOT Long before we send another order out.

          so you are stating that the indicator KNOWS the position

          you wrote "The example provides the market position and the quantity already you really don't need those lines in your post #48"

          but how does the condtion set know to look at the position?

          Thanks


          It occurred to me you might be referring to these items

          EntriesPerDirection = 1;
          EntryHandling = EntryHandling.AllEntries;
          IsExitOnSessionCloseStrategy = true;
          ExitOnSessionCloseSeconds = 30;
          IsFillLimitOnTouch = false;
          MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
          OrderFillResolution = OrderFillResolution.Standard;
          Slippage = 0;
          StartBehavior = StartBehavior.WaitUntilFlat;
          TimeInForce = TimeInForce.Gtc;
          TraceOrders = false;
          RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
          StopTargetHandling = StopTargetHandling.PerEntryExecution;

          IF SO, AS THIS AN INDICATOR THOSE ITEMS WILL NOT COMPILE
          Last edited by DTSSTS; 12-14-2021, 05:38 PM.

          Comment


            #50
            Hello DTSSTS,

            Thanks for your reply.

            The account class can be used in both indicators and strategies.

            I have attached exactly the same as the example AccountStuff but in an indicator form.

            This demonstrates that you can get the instrument name, the market position, the price, the quantity in an indicator using the methods and properties in the example indicator:

            I trust that this should conclude the inquiry of how to get market position and quantity information in an indicator form.

            AccountStuffIndicator.zip

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            88 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            135 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            119 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            69 views
            0 likes
            Last Post PaulMohn  
            Working...
            X