Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Consecutive Losing trades- how to double down

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

    Consecutive Losing trades- how to double down

    I have read this:http://www.ninjatrader.com/support/f...ad.php?t=19289

    but not exactly what I am looking for- must be an easier way to count loses, as I am trying to build something that double downs up to 6 times... if 6 consecutive loses. and 3 for 3 etc..

    I need to do something like:

    if (Performance.ConsecLosingTrades.Count > 1 && Performance.ConsecLosingTrades.Count < 2)
    Contracts= Contracts *2;

    if (Performance.ConsecLosingTrades.Count > 2 && Performance.ConsecLosingTrades.Count < 3)
    Contracts= Contracts *3;

    I understand ConsecLosingTrades is not a definition, but is there a way to do that?

    Thanks in advance!

    #2
    wprosser, you could look into the MaxConsecLoser from the Performance class, this could be accessed from the realtime only trades collection as well if desired :

    Comment


      #3
      I was looking at that, my fear is MaxConsLoser gives me the max cons loser of ALL trades.

      Is there a way just to get consecutive losers? or do i have to specify a time frame for MaxConsecLoser?

      Comment


        #4
        Correct, this property would track the Max seen, it could either be on the complete historical collection of trades or for the real-time generated ones. Any consecutive looser statistic would need to have a reference point though.

        Comment


          #5
          Hmm, this compiles, but is this correct (not familiar witth trade count)

          bool CountSix = (Performance.AllTrades.Count- (Performance.LongTrades.Count-6)> );

          if (CountSix && (Performance.AllTrades.TradesPerformance.MaxConsec Loser >= 5 && Performance.AllTrades.TradesPerformance.MaxConsecL oser < 6))

          TIA

          Comment


            #6
            Or i guess, I am trying to get the last six trades, and run MaxconsLosers of the following:

            (Performance.LongTrades.Count-6) ? Or would i use something like Trade lastTrade -6 ?

            Comment


              #7
              I don't think this code would give you what you seek, please see this simple example attached, I changed the reference sample a bit for you, if we have 3 trades in a session in a row - trade 3 contracts, else just trade 1. This could be further enhanced but I believe is what you're after here.
              Attached Files

              Comment


                #8
                Thanks, I think you are correct- the only way to do it is to run the loop! Makes sense.

                One final question. The two ninja example files both use:

                if (Bars.FirstBarOfSession && FirstTickOfBar)
                {
                lastThreeTrades = 0;
                priorSessionTrades = Performance.AllTrades.Count;
                }

                /* Here, Performance.AllTrades.Count - priorSessionTrades checks to make sure there have been three trades today.
                priorNumberOfTrades makes sure this code block only executes when a new trade has finished. */


                That is fine, but I am having issues with the reset on a positive trade. So i replaced that code with

                protected override void OnBarUpdate()
                {
                if (Performance.AllTrades.WinningTrades.Count-(Performance.AllTrades.WinningTrades.Count - 1) >=1)

                {
                lastTradeSerries = 0;
                priorSessionTrades = Performance.AllTrades.Count;
                Contracts= DefaultQuantity;
                }

                And not exactly working. I Presume I have something off. I figured that code would determine if my last trade was a winner.

                Thanks for all of you help and time!



                Comment


                  #9
                  wprosser, I would then suggest you do the reset the count if the last trade was a winner, i.e the profit > 0 :

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  670 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  379 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  111 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  575 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  582 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X