Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

STARTING a strategy after consecutive losers

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

    STARTING a strategy after consecutive losers

    Just wondering if anyone has figured out how to get a strategy to "wait" for say 2 or three consecutive losses or a certain $ draw down before executing a live trade.

    After the live trade has closed the strategy would then sit on the sidelines, waiting for another string of (simulated) losses before entering with live/real trade(s).

    The easiest way to do it would be if there was way to have a strategy running in SIM mode switch over to live on the fly - but I don't see that as possible given what I have read on line.

    Thoughts >??

    #2
    Hello,

    Thanks for the note.

    Basically you would need to simulate the trade inside of the strategy.

    For example you have lost some trades now you want to simulate some entries.

    In this case instead of calling EnterLong() to go long in the live account you would basically set a market position variable and you would record the entry price.

    if (Conditions to go long satisfied however need to simulate entry)
    {
    SimulatedMarketPosition = 1;
    SimulatedMarketEntryPrice = Close[0];
    }

    if (Conditions satisfied for long exit and we are in simulation)
    {
    SimulatedMarketPosition = 0;
    SimulatedReliazedPnL = SimulatedMarketEntryPrice - Close;
    SimulatedMarketEntryPrice = 0;
    }

    Something like that, basically you are toggling some internal variables to simulate the trade then go live when you are ready and switch to the EnterLong() method.

    -Brett

    Comment


      #3
      reinventing the wheel

      Hi Brett,

      I was really hoping not to have to reinvent the wheel on this one

      There are several threads that discuss strategies that turn off or stop after certain $ loss/draw-down or certain number of consecutive losses like the "Stopping a strategy after consecutive losers" reference sample: http://www.ninjatrader.com/support/forum/showthread.php?t=19289

      But I can't seem to find any strategies that "sit on the sidelines" waiting for and measuring theoretical (paper trade) losses...

      It's a very simple concept; but extremely powerful if executed properly.
      (I have done it on a discretionary/manual basis and it is consistently successful)

      I would think that surely somebody must have coded something similar and I just can't find in the thousands of posts on this forum.

      Anyway, I will try to create something from scratch with my limited programming skills and post it here. Hopefully some other members will kick in some ideas or chunks of code.

      Cheers,

      Chris

      Comment


        #4
        Not sure what I'm doing wrong here...Double Down Strategy

        Hi Brett,

        Along the same train of thought as the "sitting on the sidelines" idea I've been playing around with an "always in" trend following strategy in which I want to "double down" when there are consecutive losses - but I can't quite get it to work properly...

        When I run the strategy (real-time SIM playback with pre-recorded 6E data) it acts really strange -sometimes it works properly for the first few trades and then stops altogether, sometimes it increases to 2 contracts and stays there regardless of the # of consecutive losers.

        My guess is that the consecutive losers/winners is an absolute figure (as opposed measuring what just happened in the previous 4-5 trades). If that is correct, what would be the easiest way to get around that restriction/limitation>??
        Attached Files

        Comment


          #5
          Hello,

          Thanks for the post.

          Unfortunately I'm unable to debug custom code for you and I did take a quick look but didn't see anything off hand. What we would need to do here is start adding Print statements in so that you can understand what is happening to correct it.

          Please use this guide to add in Prints to isolate what is occurring.



          -Brett

          Comment


            #6
            Hi Brett,

            I'm not asking you to debug my code - I am basically asking you to explain if the command:

            "Performance.RealtimeTrades.TradesPerformance.MaxC onsecLoser"

            can be modified such that it looks at the most recent trades instead of every trade since the strategy was commenced (which I believe is what is happening here)

            If you don't know for sure please ask another member of your team - I don't want to continue trying to get it to work if it is not possible...

            Also, if there are any other relevant/similar threads that you can think of please post the link so I can LEARN.

            - That is the whole point after all.

            Cheers !



            Comment


              #7
              Hello,

              I can answer specific questions no problem.

              If you want to do that you would need to calculated this manually by accessing the trade performance data directly.

              You can use this sample which will guide you through how to do this.



              Let me know if any questions.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by fernandobr, Today, 09:11 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by timmbbo, Today, 08:59 AM
              1 response
              2 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by KennyK, 05-29-2017, 02:02 AM
              2 responses
              1,281 views
              0 likes
              Last Post marcus2300  
              Started by itrader46, Today, 09:04 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by bmartz, 03-12-2024, 06:12 AM
              5 responses
              33 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Working...
              X