Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading the opposite of a losing strategy

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

    Trading the opposite of a losing strategy

    There is a trading strategy named SampleMACrossOver included with NT. Using 13/24 for the MA and a 60 min. ES chart, I get a PF of .25.
    #1 I can't figure out what the exit criteria is. It's not apparent in the code, at least not to me.
    #2 If I reverse the trade entry code to enter short vs. enter long and vice versa, I get the same results, .25 PF. How do I change the code to trade the inverse of this strategy and thus get a PF of the inverse of .25?

    Seems simple enough, but I'm stuck. Any help?
    Thanks in advance.

    #2
    Originally posted by Marshmellowhead View Post
    There is a trading strategy named SampleMACrossOver included with NT. Using 13/24 for the MA and a 60 min. ES chart, I get a PF of .25.
    #1 I can't figure out what the exit criteria is. It's not apparent in the code, at least not to me.
    #2 If I reverse the trade entry code to enter short vs. enter long and vice versa, I get the same results, .25 PF. How do I change the code to trade the inverse of this strategy and thus get a PF of the inverse of .25?

    Seems simple enough, but I'm stuck. Any help?
    Thanks in advance.
    Hi,

    I cant help you with the programming, but i can tell you that a big losing strategy that places inverted orders that that isnt as profitable as you think! i done that in Fibonacci Trader...

    Comment


      #3
      MarshmellowHead, the exits aren't actually specified; an exit occurs when a reversal takes place because the MA Crossover strategy is always in the market. If the current position is long and you call EnterShort(), it will close out the long and place a market sell order.

      To reverse the SampleMACrossover strategy, you will have to create a new strategy (because you can't edit the built-in strategies) and use the following code:
      Code:
      if (CrossAbove(SMA(Fast), SMA(Slow), 1))
          EnterShort();
      else if (CrossBelow(SMA(Fast), SMA(Slow), 1))
          EnterLong();
      AustinNinjaTrader Customer Service

      Comment


        #4
        Thanks for the response Austin. Always in the market makes sent, but he chart generated by the strategy doesn't make sense to me. I've attached a screenshot of the chart indicating the executions using the strategy. There are sometimes many bars in between closing and opening a position, so can you explain how this can be if the strategy is always in a position? Also, I used your new code to do the inverse and got the exact same strategy perf. report as the original. How can this be?
        Attached Files

        Comment


          #5
          I had exit on close so any position was closed at the end of the day, that explains the exits. Now have to figure out why changing the code to the inverse gives the same results as non-inverse.

          Comment


            #6
            Correct, good spot on the ExitOnClose setting - did you recompile the code and started a new instance of the strategy after modifying it for the inverse logic?

            Comment


              #7
              I changed the code to account for the inverse strategy but when compiling, I get the error messages shown in the attached screenshot. Everything looks fine to me, so can't figure out what the error is.
              Attached Files

              Comment


                #8
                NinjaScript / C# is case sensitive, try EnterShort and EnterLong, then it should compile...

                Comment


                  #9
                  Thanks, that worked.
                  Attached are the backtest results which shows the inverse stratagy gives a very profitable results on a 60 minute chart for ES. Not a big sample size I know, only year to date data. Not sure I could trade this since it goes opposite to my beliefs...LOL. But it shows it is possible. I see people often posting the opposite of a losing strategy won't be profitable. Are there some pitfalls I'm missing? Anyone?
                  Attached Files

                  Comment


                    #10
                    Great, it just shows the 'nature' of the ES - you want to check into what kind of avg trade you produce with this inverse logic...

                    Comment


                      #11
                      Its surprising how much different certain futures perform using the canned MA crossover strategy. Again, small data set, but still interesting. I need some continuous contract data now.
                      Attached Files

                      Comment


                        #12
                        Yes, all the normally good intraday trend markets leading the way...for continuous contracts try for example eSignal or DTNIQ (you can access those in NT with the ##-## expiry).

                        For our next release NinjaTrader 7 those will be supported per default then -

                        Comment

                        Latest Posts

                        Collapse

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