• 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

cover and reverse instead of just a cover?

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

    cover and reverse instead of just a cover?

    I have been unsuccessful at trying to cover and reverse, instead of just covering, at the circled bar opening shown in the attached thumbnail.

    The buy to cover was triggered by the previous bar close above the red line.

    Please tell me how to do a cover and reverse instead of just a cover.
    Attached Files

    #2
    If you're using the managed approach you can call EnterLong() when you're currently short. Doing this will reverse your position by exiting the short and entering the long order.

    http://www.ninjatrader.com/support/h...?enterlong.htm
    Lance B.NinjaTrader Customer Service

    Comment


      #3
      I changed EnterLong(); and EnterShort(); to EnterLong(2); and EnterShort(2); but it didn’t work?

      This should work for the strategy analyzer shouldn’t it?

      is the managed approach something that takes some special control settings somewhere?

      Comment


        #4
        You won't need to use a different quantity. If you're currently long and call EnterShort(2) it will exit the long position and then enter short with a quantity of two.

        The fact that you're using EnterLong() and EnterShort() means you are using the managed approach. The unmanaged approach can be read about here if you're interested. http://www.ninjatrader.com/support/h...d_approach.htm
        Keep in mind this is only for experienced programmer and I would suggest starting with the managed approach.

        Your NinjaScript / C# Code will always be logically processed and evaluate according to your set logic – this can of course lead to unexpected results at times, thus we would suggest to simplify and debug your code to better understand the event sequence it would go through
        For debugging tips: http://www.ninjatrader.com/support/f...ead.php?t=3418

        What aspect isn't working properly for you?
        Lance B.NinjaTrader Customer Service

        Comment


          #5
          I am still unclear as to why, in the thumbnail attachment in my original post, there is only a buy to cover at 1.2882 rather than a buy to cover plus a buy to reverse the position at the same time ...... to arrive at a long position at 1.2882? Note that going long happened two bars later for no obvious reason [not obvious to me anyhow].

          Comment


            #6
            It would be helpful if you posted the part of your strategy code where the trades are entered/exited

            Comment


              #7
              You nailed it & I owe you guys one big apology. I forgot that I had altered the code. The results make sense now. So case closed.
              thanks again for all your help.

              Comment


                #8
                Originally posted by joemiller View Post
                I am still unclear as to why, in the thumbnail attachment in my original post, there is only a buy to cover at 1.2882 rather than a buy to cover plus a buy to reverse the position at the same time ...... to arrive at a long position at 1.2882? Note that going long happened two bars later for no obvious reason [not obvious to me anyhow].
                What kind of protective stop do you have in place?

                Comment


                  #9
                  No protective stops.

                  Possibly you overlooked post#7 in which I said " You nailed it & I owe you guys one big apology. I forgot that I had altered the code. The results make sense now. So case closed."

                  I could claim my short term forgetfulness is old age related [I am 82] except that I have been that way all my life. So it doesn't bother me much except when it creates confusion and inconvenience for others, like now.

                  Comment


                    #10
                    wow, aged 82 (not being from the current "internet" generation) and programming Ninjascript, respect !

                    Marco

                    Comment


                      #11
                      Just noticed you are in the Netherlands. speaking of respect, I respect you guys because you seem to have your heads screwed on relatively straight in comparison with us and a lot of the rest of the world. Makes my hair hurt when I think how dumb we can be ... over and over again.
                      Cheers & peace

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NinjaCustomer, Today, 12:14 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Marco  
                      Started by U0000999, Yesterday, 11:49 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post U0000999  
                      Started by ahadari28, Yesterday, 04:01 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post ahadari28  
                      Started by TazoTodua, Yesterday, 06:00 AM
                      2 responses
                      20 views
                      0 likes
                      Last Post TazoTodua  
                      Started by TazoTodua, Yesterday, 09:06 AM
                      1 response
                      12 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Working...
                      X