Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

exit trade when loss reaches certain percentage

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

    exit trade when loss reaches certain percentage

    hi,

    i would like to exit a trade once it reaches a certain percentage loss of the current trade. I dont know how to program in the sript editor but i hope it can be done when editing the strategy. can anyone help?

    thanks

    #2
    Hello alexkow1,

    Thank you for your post.

    When working with the condition builder you can access property Unrealized PnL. It's under category Strategy.

    NinjaScript Reference:
    You can work with the TradePerformance class to capture this information, specifically the GetProfitLoss() method.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      stop order

      Thanks for your reply, the stop seems to be working now.

      however, after putting my stop loss at -50 points, and checking the largest loosing trade i discovered that the largest loosing trade is above -50 points.

      another thing i have observed is that after a trade got stopped when it reached -50 points it immediately entered the market again because my signal was still active.
      I would like the strategy to wait until my signal changes to a new position rather than entering the market again after getting stopped out.

      Comment


        #4
        You'll have to look at the conditions for accepting a trade and redfine them if needed. You can see below for a reference sample on halting a strategy after user defined conditions as one approach.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          identify highs and lows within a certain timeframe

          Hi,
          is there a way in the conditioner to identify the high and low of the last say 1hour ?
          thanks

          Comment


            #6
            Hello alexkow1,

            Yes, see this help guide article for help on making Time comparisons with the condition buillder.

            Then, within the actions, you could set a user variable to a bar high or low. This reference sample can help with using user variables in the condition builder.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              only one trade at a time

              hi,

              thanks for your great help sofar,
              I got one problem at the moment, I would like to allow only one trade at a time.
              I got a strategy where a signal could occur again many times after the first and subsequently ninja trader opens new positions.
              How can i change this in the conditioner?
              once i got a long position for example i dont want ninja trader to generate another one (long or short) until the trade is completed.
              can anyone help?

              thanks

              Comment


                #8
                Hello,

                Use a condition like this before your order line:
                Position.MarketPosition == MarketPosition.Flat



                DenNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GussJ, 03-04-2020, 03:11 PM
                13 responses
                3,244 views
                0 likes
                Last Post GussJ
                by GussJ
                 
                Started by lorem, Today, 09:18 AM
                0 responses
                2 views
                0 likes
                Last Post lorem
                by lorem
                 
                Started by hazylizard, Today, 08:38 AM
                4 responses
                11 views
                0 likes
                Last Post hazylizard  
                Started by geddyisodin, Today, 05:20 AM
                2 responses
                20 views
                0 likes
                Last Post geddyisodin  
                Started by Max238, Today, 01:28 AM
                5 responses
                47 views
                0 likes
                Last Post Max238
                by Max238
                 
                Working...
                X