Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving stop losses and profit targets

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

    Moving stop losses and profit targets

    In my strategy I need to set a Stop Loss and Profit targets that will move under certain conditions. For example if I have a long position and the stock reaches my 1st Profit Target, I want to sell 50% of my position and move the Stop Loss and next Profit Target higher.
    Is there an example of a strategy that works like this?
    I am using the wizard to create my set condition but did not find a way to set these moving stop loss and profit targets
    Thanks

    #2
    Originally posted by agosinv View Post
    In my strategy I need to set a Stop Loss and Profit targets that will move under certain conditions. For example if I have a long position and the stock reaches my 1st Profit Target, I want to sell 50% of my position and move the Stop Loss and next Profit Target higher.
    Is there an example of a strategy that works like this?
    I am using the wizard to create my set condition but did not find a way to set these moving stop loss and profit targets
    Thanks
    To perform that kind of operation, you will have to unlock the code, and use NinjaScript.

    Comment


      #3
      agosinv, for a working example of custom set order modification, please check into the contents of this link - http://www.ninjatrader.com/support/f...ead.php?t=3222

      Comment


        #4
        OK. I was trying to use the wizard as I feel more comfortable with that while I make changes to the strategy.
        I checked the code you sent me and I will need to find out how to incorporate it in my strategy. A good weekend project for me

        Could you please explain the use of the following sentence?
        Position.MarketPosition == MarketPosition.Flat

        I saw the definition in the program help as following

        int MarketPosition(string instrument, string account)
        Gets the market position for an instrument/account combination. Returns 0 for flat, negative value for short positive value for long.

        I don't understand its use. How is the current market position calculated? Is it based on the stock or my current account value?

        Thanks a lot

        Comment


          #5
          agosinv, you're welcome - this would get your current strategy market position. This would be calculated from your strategy's conditions then.

          Comment


            #6
            I actually found a way to set my trailing stops using the wizard. I know this may not be useful to a good programmer but for me it was important to use the wizard at list until I refine my strategy to a good level.
            What I did is to open 2 long positions at the entry price instead of one (1st and 2nd). Then if my profit target is hit I close my 1st position and use a user variable to reset my stop loss to a higher value. Then I increase the value every day if the stock moves higher until my second position hits the stop loss.
            It took me a while, but I got it to work.
            Thanks

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            67 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            36 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            59 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X