Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Daily total StopLoss

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

    Daily total StopLoss

    How do you set up a strategy to close out once a "total allowable loss per day" level is reached?

    I know how to set it up to close out a position when a stoploss is triggered but the way I have my system set up now I'll have 3 or 4 stoplosses back to back to back on a limited number of days when i back test so it'd be quite welcomed if i could limit the losses on those days.

    Even with those days factored in, as far back as i can backtest on a demo, 2 months, it's actually showing up as being profitable overall. I'll take that for a 1st time strategy design attempt haha.

    i'm designing it to trade futures mostly
    the TF was....
    +$10,000 on around 80 trades with 1 contract per trade from July 1st til today during regular trading hours.
    Great in simulation but one of those $1,000+ down days would have really knocked my little account around

    Thanks
    and sorry for the long rambling part. I'm half asleep and delirious.
    Last edited by Jym85; 09-04-2009, 06:48 AM.

    #2
    Jym85,

    Please see these reference samples: http://www.ninjatrader-support2.com/...ead.php?t=4084
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks alot
      That's exactly the info I was looking for.

      Comment


        #4
        Ok nevermind about this last question
        I figured it out haha
        Last edited by Jym85; 09-05-2009, 04:02 AM.

        Comment


          #5
          ok one more question

          How do I exit out of all my of my open positions at a specified time?

          I have code in place and it works but it only prevents future trades from happening

          if (ToTime(Time[0]) >= 74500 && ToTime(Time[0]) <= 134500)
          {
          code...
          }

          i also tried to add this but with no success...

          private void StopStrategy()
          {

          CancelOrder(myEntryOrder);


          if (ToTime(Time[0]) >= 134400)
          ExitLong();
          else if (ToTime(Time[0]) >= 134300)
          ExitShort();
          }

          No errors showed up but the positions still stayed open until the session ended at midnight.

          No big deal. I would be around if i actually ran it but I just wanted specific hours in place to backtest without the Bollinger bands being skewed

          Comment


            #6
            If you wanted to exit at say, 1:45P:
            Code:
            // this code would also need logic to reset exited to false when the day resets
            if (ToTime(Time[0]) > 134500 && exited == false)
            {
                exited = true;
                ExitLong();
                ExitShort();
            }
            AustinNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by haas88, 03-21-2024, 02:22 AM
            18 responses
            207 views
            0 likes
            Last Post haas88
            by haas88
             
            Started by Board game geek, Today, 02:20 AM
            0 responses
            1 view
            0 likes
            Last Post Board game geek  
            Started by knighty6508, Today, 01:20 AM
            2 responses
            12 views
            0 likes
            Last Post knighty6508  
            Started by franatas, Today, 01:53 AM
            0 responses
            2 views
            0 likes
            Last Post franatas  
            Started by knighty6508, Today, 01:17 AM
            0 responses
            9 views
            0 likes
            Last Post knighty6508  
            Working...
            X