Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with 'SetProfitTarget' conditions in strategy builder wizard

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

    Help with 'SetProfitTarget' conditions in strategy builder wizard

    First off I am using the wizard as opposed to scripting the strategy. This is my first go at building a strategy, so bear in mind I'm a noob. My strategy is a simple inside bar strategy, with a source bar and an inside bar. The stop loss is at the high/low of the source bar and the risk reward ratio is 1:1.

    My stop loss condition looks like this 'SetStopLoss(@"InsideBarLong", CalculationMode.Price, Low[2], false).

    I am trying to create a condition for SetProfitTarget for a long position and my logic for that is from the inside bar high (entrypoint) subtract the source bar low (stop loss) and then multiply that by 2. So, I am choosing From Entry Signal = @"InsideBarLong", Mode = Price, Value = set: Price (High), 1 Bars ago, - (minus), value = set: Price (Low), 2 bars ago, * (multiply), value = 2.

    I have had the dropdown boxes set to arithmetic in both steps. But what I end up with is: SetProfitTarget(@"InsideBarLong", CalculationMode.Price, (High[1] - ((low[2] * 2) )) )

    I think my logic is correct, but I can't understand why I have all those additional parentheses in there and I don't believe it will work.

    Sorry if my form of explaining the steps is confusing, but I wasn't sure how to do it and as I said this is all new to me.

    Any help and advice would be most appreciated.

    Adam

    #2
    Hello Adam,

    Thanks for your post and welcome to the NinjaTrader Forums.

    The Strategy Builder is limited in the mathematics that it can accomplish. You are only able to offset Series by a value.

    To accomplish the goal you mentioned, I recommend using Exit methods (ex: ExitLongLimit()/ExitLongStopMarket()) for your Stops/Targets instead of Set methods.

    You would create a custom Series in the Additional Data screen of the Strategy Builder.

    In the Conditions and Actions screen, you would create an action to assign the High[1] - Low[2] to the custom Series variable (Misc folder > Set <Series name>).

    Then, when you call your Exit method (Order Management folder > Exit long position by a limit order) to place a profit target order, you could set the ExitLongLimit() Limit Price property to the custom Series (Misc folder > Custom series) and offset the custom Series by multiplying it by 2.

    Builder Screens: https://ninjatrader.com/support/help...er_screens.htm
    Conditions: https://ninjatrader.com/support/help...on_builder.htm
    Actions: https://ninjatrader.com/support/help...t8/actions.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi Brandon, thank you for the reply. I'll give that a go and see if I can work it out.

      Comment


        #4
        Hi Brandon,
        So, I have tried what you suggested. I created 2 objects in the additional data\custom series called 'RiskLong' and 'RiskShort'. Then in actions I created:

        'RiskLong[0] = (High[1] - (Low[2]))'

        and:

        'RiskShort[0] = (High[2] -(Low[1]))'.

        So, do I now create an action inside 'conditions and actions' (and do I need a corresponding condition for this) e.g:

        ExitLongLimit(DefaultQuantity, (RiskLong[0]*2, @"ExitInsideBarLong", @"InsideBarLong")

        Or inside 'stops and targets', do I create :

        'SetProfitTarget(@"InsideBarLong", CalculationModeTicks, (RiskLong[0]*2) )

        or do I create both?

        I'm finding this part a bit confusing.

        Regards

        Adam

        Comment


          #5
          Hello Adam,

          Thanks for your notes.

          That is correct, you would now pass the custom Series (RiskLong) into the Exit method as the price and offset the custom Series by multiplying it by 2.

          Offsetting an item value: https://ninjatrader.com/support/help...setAnItemValue

          This would then multiply the custom Series value (High[0] - Low[0]) by 2.

          You would use Exit methods, such as ExitLongLimit() and ExitLongStopMarket(), to place stops and targets in the strategy.

          Note that you should not use Exit methods and Set methods in the script as this would violate the Managed Approach Internal Order Handling Rules on the help guide page linked below.

          Managed Approach Internal Order Handling Rules: https://ninjatrader.com/support/helpGuides/nt8/index.html?managed_approach.htm#InternalOrderHandl ingRulesThatReduceUnwantedPositions
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          90 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          152 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          80 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          53 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          63 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X