• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy using PositionAccount vs Strategy Position

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

    Strategy using PositionAccount vs Strategy Position

    Where as Strategy looks for a strategy position to verify flat prior to enter a trade that conditions have triggered

    I want to look at the Trading Account Position prior to entering a trade

    THIS WILL ALLOW manual exits, then the Strategy knows that PositionAccount is flat and the next trigger can be triggered if conditions are met

    i am using

    StartBehavior = StartBehavior.AdoptAccountPosition;

    IsAdoptAccountPositionAware = true;

    Thanks


    #2
    Hello DTSSTS,

    Thanks for your post.

    Regarding, "I want to look at the Trading Account Position prior to entering a trade", you would use PositionAccount: https://ninjatrader.com/support/help...ionaccount.htm

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      i was given that info yesterday and recoded about 4 ways and never could get rid of the errors

      https://gyazo.com/7597536dd7e5d494f5e18ce9bb791caa

      https://gyazo.com/ec4db3a980ea81880a316d5f5ce2e533

      Comment


        #4
        i added all these items with no errors but the strategy still trade on Strat position and NOT PositionAccount

        Print("The average entry price is " + PositionAccount.AveragePrice);
        Print(PositionAccount.Quantity);
        // protected override void OnBarUpdate()
        //{
        // Raise stop loss to breakeven when there is at least 30 ticks in profit

        if (Close[0] >= PositionAccount.AveragePrice + 30 * TickSize)
        ExitLongStopMarket(PositionAccount.Quantity, PositionAccount.AveragePrice);
        if (Close[0] <= PositionAccount.AveragePrice - 30 * TickSize)
        ExitShortStopMarket(PositionAccount.Quantity, PositionAccount.AveragePrice);
        if (PositionAccount.MarketPosition != MarketPosition.Flat)
        Print("Open PnL: " + PositionAccount.GetUnrealizedProfitLoss(Performanc eUnit.Points, Close[0]));
        if (PositionAccount.MarketPosition != MarketPosition.Flat)
        Print("Open PnL: " + PositionAccount.GetUnrealizedProfitLoss(Performanc eUnit.Points, Close[0]));
        // Prints out the current market position
        Print(PositionAccount.MarketPosition.ToString() + " " + PositionAccount.Quantity.ToString());

        WHEN TESTING strategy creates position, but when manually exit position Strategy still shows position and we are no longer insync

        https://gyazo.com/36f7841bc5737bdf274841fb69fef4f7

        thanks

        Comment


          #5
          My issue may be in this statment

          else if (AtmStrategyId[Direction].Length > 0 && GetAtmStrategyMarketPosition(AtmStrategyId[Direction]) == Cbi.MarketPosition.Flat)
          AtmStrategyId[Direction] = string.Empty;

          Comment


            #6
            Hello DTSSTS,

            Thanks for your replies.

            Can you provide an overall context of what you are trying to do?
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              MANUALLY EXIT A POSITION AND HAVE THE STRATEGY POSITION BE ZERO JUST LIKE THE live account
              Strategy using PositionAccount vs Strategy Position

              01-17-2020, 03:15 PM
              Where as Strategy looks for a strategy position to verify flat prior to enter a trade that conditions have triggered

              I want to look at the Trading Account Position prior to entering a trade

              THIS WILL ALLOW manual exits, then the Strategy knows that PositionAccount is flat and the next trigger can be triggered if conditions are met

              i am using

              StartBehavior = StartBehavior.AdoptAccountPosition;

              IsAdoptAccountPositionAware = true;

              Thanks

              Comment


                #8
                Hello DTSSTS,

                Thanks for your reply.

                I may not be fully understanding what you are trying to do however:

                The start behavior only effects when the strategy is started for the first time and would only impact the transition from historical to live data. Managed approach enter/exit methods follow the strategy position. AdoptAccountPosition would just inherit the account position, it does not tell the strategy to follow the account position, and does not support new manual orders.

                You may want to add chart "buttons" to place manual orders through the strategy so that these effect the strategy position.

                Note: The atm strategy position would be unrelated to the strategy position because it is a unique strategy, and using Enter/Exit Managed Approach methods would affect the strategy that is calling those methods, not the atm.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Chart buttons meaning a custom indicator with buttons on the chart. in the code some where the buttons are directed at the strategy?

                  Comment


                    #10
                    Hello DTSSTS,

                    Thanks for your reply.

                    No, buttons that your strategy would place on the chart. Here is a link to an example: https://ninjatraderecosystem.com/use...bar-buttons-2/ Please note: The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      so i can manually close position with these buttons

                      does the position have to be opened from an open chart or can they be from the control panel Strategies tab

                      I see this file is 2015 I ask all about this over and over to manually close strategy trades over 2 years ago, never say this before

                      Comment


                        #12
                        Hello DTSSTS,

                        Thanks for your reply.

                        The buttons can be programmed to enter or exit trades within the context of the strategy. This means the strategy position and its account position would be in sync (assuming the entries were made in the context of the strategy).

                        The buttons would only work on a chart, they would not work if the strategy was created from the strategies tab.

                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          OK installed buttons, but i do not find anything in Indicator list about this, What is the Name and Where find
                          Thanks

                          Comment


                            #14
                            Hello DTSSTS,

                            Thanks for your reply.

                            If you installed the download from the forums link I provided called LongShortToolbarbutton, it will be found in the strategies folder of the Ninjascript editor as it is a strategy.


                            Paul H.NinjaTrader Customer Service

                            Comment


                              #15
                              Got It Have a nice weekend

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by pharofx, Today, 09:30 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post pharofx
                              by pharofx
                               
                              Started by swcooke, Today, 08:39 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post swcooke
                              by swcooke
                               
                              Started by bboyle1234, Today, 08:10 PM
                              1 response
                              11 views
                              0 likes
                              Last Post bboyle1234  
                              Started by shodson, 02-11-2020, 07:26 PM
                              3 responses
                              21 views
                              0 likes
                              Last Post shodson
                              by shodson
                               
                              Started by ksarin, Today, 04:31 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post ksarin
                              by ksarin
                               
                              Working...
                              X