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 ezrollin, 02-26-2022, 11:14 PM
                7 responses
                206 views
                0 likes
                Last Post kenz987
                by kenz987
                 
                Started by rocketman7, Today, 08:34 PM
                0 responses
                1 view
                0 likes
                Last Post rocketman7  
                Started by rt61968, 02-17-2018, 05:24 PM
                3 responses
                2,733 views
                0 likes
                Last Post MasterEtrad3  
                Started by nuobo, Today, 07:43 PM
                0 responses
                4 views
                0 likes
                Last Post nuobo
                by nuobo
                 
                Started by ETFVoyageur, Today, 02:04 PM
                3 responses
                22 views
                0 likes
                Last Post ETFVoyageur  
                Working...
                X