Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Taking profit from X percent of unrealized profit high

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

    Taking profit from X percent of unrealized profit high

    Hello Ninja Traders,

    I have a strategy builder problem that has so far eluded me - would appreciate some advice!

    I’m trying to implement an idea using the strategy builder. It will take profit while in a trade based upon the unrealized profit.

    An logic example of my problem would be: I enter a trade, and my trade exit strategy exits far below the highest price or majority of the profit that the trade was in – leaving it on the table, which is very frustrating.

    A numerical example of the problem would be this: I enter a trade and the trade goes to $1000, then pulls back to $400 before my exit conditions close the trade in profit.

    What I would like to do is take profit based on the pullback from the highest price of the last price change minus X percent. For example, if the price went to $1000, but then pulled back to $800 – or 20% from the high, I would like to then have the strategy automatically take profit and close the trade.

    I would use an input variable, so I could experiment with different values to take profit from the high. If the strategy could do some sort of average math calculation to determine the best place to take profit from the high during a pull back, that would also be amazing but I’m not sure how wants to describe it, other than to say, I know, there’s some calculable number, based upon the previous candles, which is mathematically, the best place to take profit during a pull back. Fun!

    Doing this would ensure that even I am able to maximize most of the profit in a trade rather than waiting for an exit conditions, which seems to leave a lot on the table.

    Appreciate the support and any feedback or ideas.

    Thanks in advance!

    Chris




    #2
    Hello Chris,

    Thanks for your post.

    We are looking into your inquiry at this time and will reach back out to you as soon as we have investigated this matter.

    Thanks for your patience; I look forward to assisting further.
    <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
      Hello Chris,

      Thanks for your patience.

      A limitation of the Strategy Builder is that only simple math is able to be done on custom Series objects.

      Something you could consider creating a custom Series variable in the Additional Data screen of the Strategy Builder and saving the UnrealizedPnL value (Strategy folder > Unrealized PnL) to the Custom Series variable when you are in a position.

      A condition could be made that checks if the Unrealized PnL (Strategy folder > Unrealized PnL) is greater than the custom Series variable and then you could assign the new Unrealized PnL value to the custom Series to update it when a higher Unrealized PnL occurs.

      This custom Series variable could then be used in your condition to place an exit order by comparing it to the strategy's Unrealized PnL value with an offset applied.

      See the help guide documentation below for more information.

      Additional Data Screen: https://ninjatrader.com/support/help...standingTheAdd itrionalDataScreen
      Offsetting a value: https://ninjatrader.com/support/help..._builder.htm#H owToOffsetAnItemValue
      Conditions: https://ninjatrader.com/support/help...on_builder.htm
      Actions: https://ninjatrader.com/support/help...t8/actions.htm

      Here is a link to our publicly available training video, 'Automate your trading with NinjaTrader's Strategy Builder', which you might find helpful.

      'Automate your trading with NinjaTrader's Strategy Builder': https://youtu.be/VxU4FR6GWNA

      I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript:
      https://ninjatrader.com/support/help..._resources.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


        #4
        Thanks for the response! I will read through and attempt to apply this information accordingly.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        52 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        70 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        43 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        48 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X