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

Can I add a stop and target after opening a position

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

    Can I add a stop and target after opening a position

    Hello,

    Is ther any way to add a stop loss and target after a position is opened? Also how should I close out the position? For example, I have a buy position open, I am up $190.00 and want to close out to take my profits. How do I do this?

    #2
    Hello dmelleady,

    Yes it would be possible to submit the profit target and stop loss some bars after an entry was made.

    I have attached a sample strategy which will submit a PT and SL 3 bars after an order was filled you can use as a sample.

    Instead of using if(CurrentBar==xBars+3) as my sample does for the if statement related to submitting the PT and SL, you could use BarsSinceEntryExecution too, see.


    To close out the position at $190 you could use SetStopLoss with the mode set to CalculationMode.Currency, see the following helpguide link,


    You could also write an if statement which said if
    Code:
    if(PositionAccount.GetUnrealizedProfitLoss(PerformanceUnit.Points, Close[0])>$190) ExitLong();
    See the following two links,




    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      This doesn't make sense to me. If I close the position with the close button will it keep my profit or does it just close at zero or negative? I am confused, I accidentally opened an order without a stop and need to close it with profit in tact?

      Comment


        #4
        Hello dmelleady,

        So I may confirm, you are not using automated strategies?

        If you were to be in a trade and hit the close button, a closing trade would be sent at the market and filled at the best bid or offer. Whether that would be for a profit would depend on the bid/ask at that time.

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          I am not using automated strategies. At this point I am manually submitting orders through chart trader.

          Comment


            #6
            Hello dmelleady,

            This would be the automated strategy development section of the forum, in the future if you would please post these types of questions in the support section of the forum or open inquiries in the Control Center>Help>Remote Support that would be appreciated.

            What you're asking to do is called an OCO, one cancels other. To place an OCO you must right mouse click on the SuperDOM and enable OCO. Place your buy limit or buy stop, followed by your sell or sell stop. Then disable OCO by right clicking the DOM and unchecking OCO. This last part, unchecking is very important to avoid ID numbers being reused.

            Understanding "One Cancels Other"


            Let us know if we may be of further assistance.
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Waxavi, Today, 02:10 AM
            0 responses
            3 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by TradeForge, Today, 02:09 AM
            0 responses
            7 views
            0 likes
            Last Post TradeForge  
            Started by Waxavi, Today, 02:00 AM
            0 responses
            2 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by elirion, Today, 01:36 AM
            0 responses
            4 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by gentlebenthebear, Today, 01:30 AM
            0 responses
            4 views
            0 likes
            Last Post gentlebenthebear  
            Working...
            X