Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy checking account position

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

    Strategy checking account position

    Hi,
    Ninja Support =)

    First of all - sorry for my english, it's not my native language.

    I have a question. Is it possible to make the strategy to check the account position and do not open the position in the same direction if such a position already exists ?

    I mean do not open longs if there is long position and the same about shorts.

    I mean such situations, then i reload historical data and the strategy starts again too. So if the signal for opening still exists it will send order once again.

    I have to refresh/reload my charts automatically (and I found the solution for that) but I don't want such type of situations.

    Thanks

    #2
    Hi Serge,

    Welcome to our forums!

    You can use MarketPosition to make sure you are flat when a strategy is restarted. This only applies to the strategy position, not the overall account position.

    Something like...
    Code:
    if (Position.MarketPosition == MarketPosition.Flat)
    More info at - http://www.ninjatrader-support.com/H...MarketPosition
    TimNinjaTrader Customer Service

    Comment


      #3
      Tim,
      But I already clarified my situation. My charts are automatically refreshing with let say 3 min. interval.

      To make things clearer - I have strategy based on renko chart and that's not typical renko (as it's available in NT7) but interval based renko (3 min for example, so for drawing it, strategy takes the bar closing price only once in a 3 min)

      Now you should understand why it's so critical for me. If the strategy use simple candlesticks - there is no problem, the position will not open more than once. But than we use such renko - it will add the position as many times as long last renko bar remains "signal" while we reload the chart.

      Comment


        #4
        Hi Serge,

        If you don't reload the chart and the strategy manually, the MarketPosition check should be ok. However, with the custom chart type, I am unable to say if that will be the case.

        Unfortunatley, accessing account balance information is not supported with NT 6.5
        Last edited by NinjaTrader_Tim; 03-25-2010, 01:57 PM.
        TimNinjaTrader Customer Service

        Comment


          #5
          Tim,
          I have no problems if don't refresh. But I have to refresh, the reason is difference between real time drawing chart and chart after reloading.

          What about NT7, will the account check be available ?

          Comment


            #6
            Hi Serge,

            Yes, with NT7 this will be available.
            Please see the following link under the "New Account Access" section.
            TimNinjaTrader Customer Service

            Comment


              #7
              Tim,
              Ough -)) that's would be great.
              I'm already have NT7 installed, but as I understand it's still not available for live trading, programming ?
              If not - when ?
              Last edited by Serge; 03-25-2010, 11:49 AM.

              Comment


                #8
                Hi Serge,

                NT7 is in beta testing and will be recommended for live trading once we are confident that the platform is fully ready.
                TimNinjaTrader Customer Service

                Comment


                  #9
                  Tim,
                  But, is it ready for full-options programming ? I need to rewrite my strategies and want to do it in advance.

                  Comment


                    #10
                    Serge, you could start testing it's new NS methods out, but please remember it's in beta still.

                    For this NT7 call, you want to look into GetAccountValue(AccountItem accountItem) - which could be BuyingPower, CashBalance and RealizedProfitLoss.

                    Comment


                      #11
                      Hi Serge,

                      Yes, you can translate strategies with the current NT7 version.

                      NinjaScript Code Breaking Changes
                      Please review the list of code breaking changes at the following link - http://www.ninjatrader-support2.com/...ad.php?t=21016
                      Last edited by NinjaTrader_Tim; 03-25-2010, 12:28 PM.
                      TimNinjaTrader Customer Service

                      Comment


                        #12
                        Bertrand,
                        Well, now you make me hesitate. Please clarify one more time.

                        Here is the example: my account have a position 1 contract long, then I start auto-strategy and it gives signal for going long 1 contract. But I don't want my account to have a position more than 1 contract to any side ever.
                        However I want the strategy close this 1 contract (that was opened before) by strategy rules.

                        Also when the strategy will give a signal for closing, I want it to make this only one time. That's for case if my charts will be refreshed (and strategy starts again) and conditions for closing will be in place still (in NT 6.5 strategy after closing 1 contract long, will close it more and more again, so instead of being flat I will have short position)


                        So if I can realise all these conditions in NT7 ?
                        Last edited by Serge; 03-25-2010, 01:37 PM.

                        Comment


                          #13
                          Hi Serge,

                          Unfortunately there is not a method to check for an open account position. However I will submit this for consideration for future releases.
                          TimNinjaTrader Customer Service

                          Comment


                            #14
                            Tim,
                            It's a very pity to hear that. Because that's what I was asking about since the thread starting and earlier you said that it'll be possible (

                            Then I have another question. If the problem with charts difference after reloading, that's describing here http://www.ninjatrader-support.com/H...BuildChartBars

                            will be solved in NT7 ?
                            Last edited by Serge; 03-25-2010, 02:20 PM.

                            Comment


                              #15
                              Originally posted by NinjaTrader_Tim View Post
                              Hi Serge,

                              Unfortunately there is not a method to check for an open account position. However I will submit this for consideration for future releases.
                              The distinction between strategy position and account position is useful when users trade each instrument with multiple strategies.

                              However for a number of users like myself, we may trade multiple strategies but each instrument is traded only by 1 strategy. We don't trade a instrument with 2 or more strategies.

                              For such users, we prefer to be absolutely sure that our strategies are in sync with our account position and orders, thus would like to access them in our strategy code.

                              this is important, a number of users have requested for this.
                              Please make this a priority.

                              thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              649 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              370 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              573 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              576 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X