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 configure the profit target logic in a strategy

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

    How to configure the profit target logic in a strategy

    I'm trying to replace the profit target with another exit condition under "Conditions and actions"

    What I've done is instead of setting the profit target on 20 pips, I've made a condition that exit the long position (I only allow one to run in a time) when the unrealized PnL is equal 20 pips or more.

    While it works, it doesn't work same as the ordinary Profit target doesn't return the same results, and I'm not sure why.

    Can anyone help with this pls?

    Thanks!
    Last edited by bestmethod; 07-22-2020, 05:19 PM.

    #2
    Hello bestmethod,

    Thanks for your post.

    What Calculation mode does the strategy use? (Calculate.OnBarClose, Calculate.OnPriceChange, to Calculate.OnEachTick)

    Where are you observing this? On a live data chart, in market replay, or in the strategy analyzer.

    What specific exit order are you using?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,

      Thanks for your response, its calculated "Calculate.OnPriceChange" I'm observing this in the strategy analyzer, and I'm using "ExitLong(Default Quantity)"

      Appreciate your support
      Thanks

      Comment


        #4
        Hello bestmethod,

        Thanks for your reply.

        The Calculate mode of OnPriceChange in the strategy analyzer will actually be run as Calculate.OnBarClose (unless you enable tick replay and have the supporting tick data for the analysis period). The reason it runs as Calculate.OnBarClose is because the historical data does not contain all of the ticks that made the bar which means your strategy is called once per bar. In the case of your exit condition, once the exit decision is made by your strategy, the exit order (market type) can only be filled on the next bar which could be well above or below the 20 ticks.

        The SetProfitTarget() uses a limit order so it fills at that price as long as price goes through that level.

        A more accurate comparison could be made by using Playback with market replay data as this provides all of the ticks that build the bar and your strategy can run with Calculate.OnPriceChange.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello Paul,
          But if i use SetProfitTarget() it will desactive my breakeven logic in my strategy. Do you have any sample of how configure the profit logic?

          Thanks

          Comment


            #6
            Hello Santillana1971,

            Thanks for your post.

            I do not have any examples to provide.

            If you use SetStopLoss() as the stop order for the breakeven, you would be able to use the SetProfitTarget().
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mattbsea, Today, 05:44 PM
            0 responses
            4 views
            0 likes
            Last Post mattbsea  
            Started by RideMe, 04-07-2024, 04:54 PM
            6 responses
            31 views
            0 likes
            Last Post RideMe
            by RideMe
             
            Started by tkaboris, Today, 05:13 PM
            0 responses
            2 views
            0 likes
            Last Post tkaboris  
            Started by GussJ, 03-04-2020, 03:11 PM
            16 responses
            3,282 views
            0 likes
            Last Post Leafcutter  
            Started by WHICKED, Today, 12:45 PM
            2 responses
            20 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Working...
            X