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

How to do the following using NT8 strategy builder?

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

    How to do the following using NT8 strategy builder?

    I would like to do the following using NT8 strategy builder :

    - When my open trade is profitable (for example after reaching x% or x ticks in profit), buy a second contract.
    - Setting a proper trail stop, currently I am doing the following:
    SetTrailStop("", CalculationMode.Ticks, 2, false);
    but apparently it doesn't work, I would like to have a stop that secures the profit with a distance of 10 ticks.


    Also, is it possible to use the strategy builder to detect a trend?

    #2
    Hello Harry Croi,

    Thanks for your post and welcome to the NinjaTrader forums!

    "When my open trade is profitable (for example after reaching x% or x ticks in profit), buy a second contract." You would want to use, in the conditions, Strategy>UnrealizedPNL and set the "currency type" as you wish. Note: you will need to set the "entries per direction" parameter to 2 in the strategy parameters when you apply the strategy.

    "Setting a proper trail stop, currently I am doing the following:SetTrailStop("", CalculationMode.Ticks, 2, false);" I don't know what your definition of proper is but the way SetTrailStop works is that when the order is filled, a stop is placed however far away you have specified (2 ticks). For each tick that the trade goes into profit, the stop will move that much maintaining the same distance from the highest profit price to the stop. 2 ticks seems pretty tight. In addition, the use of a trailing stop requires the strategy to run in a different calculate more, from the help guide, "Trail stop orders are modified based on the strategies 'Calculate' settings. In the case of 'Calculate' on bar close, when the bar closes the trail stop order modification will occur using the lowest/highest price of the bar as the reference price to apply the trail offset. Subsequently if the open price of the next bar is significantly higher or lower than this price then there is a possibility that the calculated trail stop price is now an invalid stop price. This is a risk with modifying any stop order closer to the current market price since any modification above/below the current price would be rejected." Reference: https://ninjatrader.com/support/help...ttrailstop.htm

    "Also, is it possible to use the strategy builder to detect a trend?" That would depend on how you define a trend. Tools that are available in the Strategy builder are Rising and falling conditions, slope, Higher time frames. Crossabove and crossbelow. Using the Swing indicator is another tool. there may be others depending on your needs.

    Just to cover the bases here are the educational resource available on the strategy builder:
    Free live webinar every other Thursday at 4:00 PM EST, through this link to all webinars: https://ninjatrader.com/PlatformTraining
    Previous recording of the Strategy Builder 301 webinar: https://youtu.be/HCyt90GAs9k?list=PL...auWXkWe0Nf&t=2
    Help guide for the strategy builder: https://ninjatrader.com/support/help...gy_builder.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your fast response; however, just to be clear, what I want to achieve exactly is the following :

      Example:

      GC position is now profitable +10 ticks > buy another contract of GC

      I've tried: Strategy>UnrealizedPNL as you recommended but it remains unclear for me especially as I am willing to buy another a contract of the same instrument, an example will be really helpful, thanks!

      Comment


        #4
        Hello Harry Croi,

        Thanks for your reply.

        On the left side of the condition builder Strategy>UnrealizedPNL, set to ticks. In the center select equals, on the right side select Misc>Numeric value and enter 10.

        You may need additional conditions so that you only place the order once.
        ​​​​​​​
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the reply.
          However, I added what you recommended to the strategy as a "new set"

          Position.GetUnrealizedProfitLoss(PerformanceUnit.T icks, Default input[0]) = 10
          Then I added the following on "Do the following"

          EnterLong(DefaultQuantity, @"Buy 2nd");
          But apparently it doesn't work (I am backtesting).

          By the way, what will happen if there are 3 different positions open when "Unrealized Profit" is 30 ticks (10 in GC, 10 in NQ, 10 in ES)?

          Is it possible to add a limit of max open position to 2 and what condition should I add to make sure that it will trigger only once not every 10 ticks?

          Comment


            #6
            Hello Harry Croi,

            Thanks for your reply.

            The strategy builder can only place orders to the primary instrument on the chart. It would not be able to place orders to multiple instruments.

            The method to get unrealized profit will only provide the unrealizedPNl of the strategy, not of the account. You would need to have an order placed by the strategy and when its unrealizedPNl = 10 ticks the order would be placed.

            "Note: you will need to set the "entries per direction" parameter to 2 in the strategy parameters when you apply the strategy." this will help to limit the trades.

            You could add further conditions to only enter when at 10 ticks and a bool variable that you create is set true. Once you place the order set the bool variable to false to prevent further orders. In a set you can check to see if you have a flat market position and from there reset the bool back to true: https://ninjatrader.com/support/help...ionComparisons

            Please take the time to review the educational references previously provided, they won't answer all questions but will help familiarize you with where things are.


            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hi Harry Croi,
              Did you also follow the additional advice from PaulH?
              "Note: you will need to set the "entries per direction" parameter to 2 in the strategy parameters when you apply the strategy."
              NT-Roland

              @Edit: Crossed postings. I was apparently too slow ...
              Last edited by NT-Roland; 08-27-2020, 02:41 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Barry Milan, Today, 10:35 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by WeyldFalcon, 12-10-2020, 06:48 PM
              14 responses
              1,428 views
              0 likes
              Last Post Handclap0241  
              Started by DJ888, Yesterday, 06:09 PM
              2 responses
              9 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by jeronymite, 04-12-2024, 04:26 PM
              3 responses
              40 views
              0 likes
              Last Post jeronymite  
              Started by bill2023, Today, 08:51 AM
              2 responses
              16 views
              0 likes
              Last Post bill2023  
              Working...
              X