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

NT8 strategy using auto entry but manual exit of position.

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

    NT8 strategy using auto entry but manual exit of position.

    In NT7 with a Strategy running using a 12 tick trailing stop.

    Once trade is entered, I am able to "Manually Move" the stop via Super DOM or Jigsaw DOM...

    Yes, the stop also moves when a New Bar is created but I've been quick enough to adjust it again.

    Is there a way to Code the Manual Movement via "Jigsaw DOM" of a trailing stop or static stop in NT8..

    Thank You!

    Greg

    #2
    Welcome to the forums, greg500!

    I see that you have posted in the NinjaTrader 8 forum and have titled your thread for NT8, so I will provide NinjaTrader 8 resources to answer your inquiry. Although the same approach is valid for NinjaTrader 7 with the exception of some different syntax.

    SetProfitTarget SetStopLoss and SetTrailStop will function with internal rules to update the stop loss to the assigned level after new bar iterations.

    To allow for a stop loss to be modified by user input, you can use the Exit order methods with the isLiveUntilCancelled overload. This way, you can submit the initial stop loss and adjust it as you please within your code, and as long as the Exit method does not get called again, the user may move the stop to any level they desire.

    I've included some sample code demonstrating how this can be done.

    Code:
    protected override void OnExecutionUpdate(Cbi.Execution execution, string executionId, double price, int quantity, 
    	Cbi.MarketPosition marketPosition, string orderId, DateTime time)
    {
    	if(execution.Name == "MyEntry")
    		ExitLongStopMarket(0, true, 1, Position.AveragePrice - 10 * TickSize, "MyExit", "MyEntry");
    }
    
    protected override void OnBarUpdate()
    {
    	// Skip Historical Processing
    	if(State == State.Historical)
    		return;
    	if(Position.MarketPosition == MarketPosition.Flat)
    		EnterLong("MyEntry");
    }
    Publicly available documentation on the items used can be referenced below.

    OnExecutionUpdate() - https://ninjatrader.com/support/help...tionupdate.htm

    ExitLongStopMarket() (see isLiveUntilCancelled overload) - https://ninjatrader.com/support/help...stopmarket.htm

    Please let me know if I can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      Thank you so much for responding and please forgive my lack of ninja script understanding.

      I will hire a programmer to write the script in NT8.

      Question... If these conditions are written, can I manually move the Stop in the DOM?

      Sorry to be ignorant.

      Greg

      Comment


        #4
        Hello Greg,

        Thanks for your reply.

        If the logic is written similar to how my previous post describes, then the stop could be manually adjusted from any part of the platform that can manage orders. This would include Chart Trader, the SuperDOM and likely 3rd party AddOns that allow order manipulation.

        If it interests you, we can have a representative of our EcoSystem reach out with additional information on NinjaScript Consultants that would happy to write this script or any other at your request.

        Please let us know if this is the case.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,

          Yes, if you would be so kind to have a script coder "who would know how to do this manually exit from dom",,, email or call me. Thank you for helping!

          Greg
          Last edited by greg500; 04-04-2018, 02:17 PM.

          Comment


            #6
            Hello Greg500,

            Thank you for your post.

            You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:

            Search trading indicators, apps and services to personalize your NinjaTrader software. Explore custom trading indicators, automated strategies, free trading apps & more!


            You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

            This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

            Let me know if I may be of further assistance
            Jared M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by funk10101, Today, 09:43 PM
            0 responses
            6 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            37 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            44 views
            0 likes
            Last Post bill2023  
            Started by yertle, Today, 08:38 AM
            6 responses
            26 views
            0 likes
            Last Post ryjoga
            by ryjoga
             
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            24 views
            0 likes
            Last Post algospoke  
            Working...
            X