Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exiting Position Impossible?

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

    #16
    imported post

    Oli,

    After further investigation, it seems that there has been a misunderstanding. I will post here shortly a method that will allow you to sync your account to your strategy position.

    Ray
    RayNinjaTrader Customer Service

    Comment


      #17
      imported post

      Ray,

      surely there is a way to override the mechanism which prevents Exit commands from functioning when the Strategy is flat? I can't believe that there is not... that's all I need, a way to use the Exit commands when Position.MarketPosition is flat.


      Just saw your below.... will wait

      Comment


        #18
        imported post

        Oli,

        I have decided to provide a new methodthat will execute orders independant of the NinjaScript Enter() and Exit() internal logic. This will be availabe in the next release likely sometime next week.

        The intent of this is -

        - To sync an Account.Position --> Strategy. Position (you should never try to go the other way, syncing Strategy to Account position)
        - Will only work in real-time processing, not Historical

        Ray

        RayNinjaTrader Customer Service

        Comment


          #19
          imported post

          Ray that sounds good.

          I have coded my scripts so that as soon as the position goes flat, they revert back to using the internal Strategy controls. What this means is that

          1) a strategy is restarted and Account is not flat but Strategy is flat.

          2) This is fine because the script knows that the account is not flat and ignores the Strategy positions at first.

          3) then an Exit condition occurs and it needs to exit, even though the Strategy still thinks it is flat (THIS is where I hope your new method comes to the rescue (and I'll happily beta-test it for you :P)

          4) Because the account now really is flat, Strategy==Account and Strategy level Position logic works fine and everything is back in order...

          Please keep me updated,

          Thanks,

          Comment


            #20
            imported post

            Oli,

            So basically, your idea is:

            - If the account is not flat but the strategy is flat, wait until the strategy generates an exit condition and at that time, close out the account position, then both account and strategy are flat?

            What do want to do here:

            - Account flat, strategy long

            And here:

            - Account long 1, strategy long 2

            We are thinking about a Synchronization() method that can be called and would provide internal handling so the sync order generated is processed to ensure that its filled or if rejected, provide additional handling etc...
            RayNinjaTrader Customer Service

            Comment


              #21
              imported post

              Ray,

              I do not want something that issues buy/sell orders outside of my Strategy logic.

              This situation where Strategy != Account is ok for me, as long as I can EXIT when when ever I want (ie even when Strategy is flat).

              I have found the Strategy working on Historical Data feature to be a very large hassle and so have all Enter/Exit commands inside a {if (!Historical)}. I'll breifly explain here why the Strategy working off Historical data is a not such a good idea. Let's say Event X happens and the Strategy is not working. The Strategy is restarted, it goes back through the Historical data and decides that it is Long. Problem is Strategy wasn't working when this signal came along and so Account is Flat. Then the "Strategy" Position is just some fantasy, more like a back test. The only thing that matters is that Account is Flat, not that the Strategy "should" be long.

              I suggest you dump the Historical Strategy stuff and simply have the Strategy align itself to the Account every time the Strategy is started (ie as part of Initialize()). Then Strategy.Position == Account.Position right from the start and alwaysand all these problems disappear. More than this it is a great feature in that all you have to do to re-align Strategy and Account is refresh the Strategy. In fact if you would allow me to programatically alter the logic state of Position.MarketPosition I could reset it already myself...

              I also strongly suggest adding Order Status logic as well. A long is only a long when order=filled. But between submitting -> filled Account should not report itself as Flat. It is Pending. So really there are FOUR, not THREE, Position states (long, short, flat, pending)






              Comment


                #22
                imported post

                Oli,

                With all due respect, if you find our model a joke, then why try and squeeze a square peg into a round hole? Although I am happy to work with you and support you on our model, it sounds like you need a lower level programming environment?

                Syncing a strategy to an account position at start up is just not valid. One can have many strategiesrunning concurrently including manual trades. You can not always assume that an account position should always equal a strategy position.

                Ray
                RayNinjaTrader Customer Service

                Comment


                  #23
                  imported post

                  Ray,

                  absolutely no disrespect intended there. I have written large chuncks of highly intense systems using yourapplication and am on here every working day working through my technical issues with you guys so that speaks a lot :dude:

                  I don't follow your logic at all. Even if I have 10000000 strategies all running at the same time a pointing at the same instrument they all need to know only one thing: what is the current account position. I have not idea why you think this it istrue that Strategies need their own Position layer. Can you give a simple example?

                  Comment


                    #24
                    imported post

                    Oli,

                    - I have a SuperDOM and I have taken amanualposition long in the ES for 2 contracts, my account position is 2 long.

                    - I run a strategy on the ES that says I am flat.

                    In the above situation, if you were to assume that the strategy position should match the account position, the strategy would then sell the 2 long to put the account flat.


                    ---> Problem. My manual trade was just closed and I did not want this to happen.

                    If this example is not clear enough then we will neveragree so lets just agree to disagree and move on.

                    Ray
                    RayNinjaTrader Customer Service

                    Comment


                      #25
                      imported post

                      I agree with you - I just would never enter trades that go against or outside my system. What you are saying is that this person has entered a trade that possibly conflicts with a running active strategy which no sane person would ever do. In that situation you would have to simply turn the strategy off. The alternative is the current set up which I think creates way more problems than it solves.

                      But I also agree - lets move on.

                      What I need is very simple. I need something, a switch or simply on option that allows me to submit Exit orders when Strategy.Position is Flat. It is that simple. Something like FlattenLimit(). This submits the order to the Account regardless of Position.MarketPosition.

                      Comment


                        #26
                        imported post

                        Ray,

                        do you think that some form of workaround for my problem is possible?

                        Thanks for your time...

                        Comment


                          #27
                          imported post

                          Yes, next release.
                          RayNinjaTrader Customer Service

                          Comment


                            #28
                            imported post

                            Ok, I've read this thread. I'm wondering if my problem is the same. I'm working on my strategy, and everytime I F5 I get back trades. I see that the unrealized PnL is still calculating, yet I can't see an open order, nor is the position tab showing any trades. Yet, I'm seeing TraceOrders spit out data as if I was in a trade. How can I stop this? Is there a setting, or do I have to hack something, or wait for next realease?

                            Thanks.

                            Comment


                              #29
                              imported post

                              Not the same.

                              When you apply a strategy, it processes on your historical data set and you are either flat, long or short.

                              If the strategy is not flat, then it holds a virtual position. You can then manually adjusts your account if you want to have the account in sycn with your strategy position.

                              There are options that control how the strategy transitions from a historical state to a live state. See the Help Guide Options > Strategies section. In the application, see Tools > Options > Strategies > NinjaScript.

                              Ray
                              RayNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by TraderBCL, Today, 04:38 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post TraderBCL  
                              Started by Radano, 06-10-2021, 01:40 AM
                              19 responses
                              606 views
                              0 likes
                              Last Post Radano
                              by Radano
                               
                              Started by KenneGaray, Today, 03:48 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post KenneGaray  
                              Started by thanajo, 05-04-2021, 02:11 AM
                              4 responses
                              470 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by aa731, Today, 02:54 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post aa731
                              by aa731
                               
                              Working...
                              X