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.

    LanceNinjaTrader 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?
        LanceNinjaTrader 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 love2code2trade, Yesterday, 01:45 PM
                      4 responses
                      28 views
                      0 likes
                      Last Post love2code2trade  
                      Started by funk10101, Today, 09:43 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post funk10101  
                      Started by pkefal, 04-11-2024, 07:39 AM
                      11 responses
                      37 views
                      0 likes
                      Last Post jeronymite  
                      Started by bill2023, Yesterday, 08:51 AM
                      8 responses
                      44 views
                      0 likes
                      Last Post bill2023  
                      Started by yertle, Today, 08:38 AM
                      6 responses
                      26 views
                      0 likes
                      Last Post ryjoga
                      by ryjoga
                       
                      Working...
                      X