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

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?


    Paul H.NinjaTrader Customer Service

    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.
        Paul H.NinjaTrader Customer Service

        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
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Jonafare, 12-06-2012, 03:48 PM
            5 responses
            3,984 views
            0 likes
            Last Post rene69851  
            Started by Fitspressorest, Today, 01:38 PM
            0 responses
            2 views
            0 likes
            Last Post Fitspressorest  
            Started by Jonker, Today, 01:19 PM
            0 responses
            2 views
            0 likes
            Last Post Jonker
            by Jonker
             
            Started by futtrader, Today, 01:16 PM
            0 responses
            7 views
            0 likes
            Last Post futtrader  
            Started by Segwin, 05-07-2018, 02:15 PM
            14 responses
            1,791 views
            0 likes
            Last Post aligator  
            Working...
            X