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

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.
    Brandon H.NinjaTrader Customer Service

    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​​
      Brandon H.NinjaTrader Customer Service

      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 rhyminkevin, Today, 04:58 PM
        3 responses
        47 views
        0 likes
        Last Post Anfedport  
        Started by iceman2018, Today, 05:07 PM
        0 responses
        5 views
        0 likes
        Last Post iceman2018  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        7 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        14 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        50 views
        0 likes
        Last Post futtrader  
        Working...
        X