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

Unrealized Profit Exit

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

    Unrealized Profit Exit

    Hi,

    I am using the managed approach with "on price change" selected in a live simulated account. Under conditions, I have one set of conditions "if all" which includes unrealized profit in currency >= $250 plus other conditions, then exit long or short. I have another set of conditions "if all" which includes unrealized profit as < $250 plus other conditions, then exit long or short. The trades are exiting, but not factoring in the profit condition. Is this due to a set stop loss I have in place? I have read the "unwanted positions" section of the manual...

    Thanks

    #2
    Hello thaboushca,

    Thanks for your post.

    To clarify, when you say "due to a set stop loss I have in place" are you referring to using the SetStopLoss() method to place a stop loss order?

    Are you reporting that the Exit methods are not called when your condition becomes true?

    If you are using SetStopLoss() and Exit methods, is your stop loss being hit before the conditions to submit the Exit method are becoming true?

    Have you added debugging prints to the strategy to understand exactly how the conditions are evaluating?

    If not, to understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.


    We look forward to assisting further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      Thanks for the quick reply. See my responses below:

      To clarify, when you say "due to a set stop loss I have in place" are you referring to using the SetStopLoss() method to place a stop loss order? Yes

      Are you reporting that the Exit methods are not called when your condition becomes true? Yes

      If you are using SetStopLoss() and Exit methods, is your stop loss being hit before the conditions to submit the Exit method are becoming true? No

      I can try debugging and the prints, I just wanted to verify first that the set stop loss was not preventing such an exit. I will re-check everything.

      Thanks again​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by AaronKoRn, Today, 09:49 PM
      0 responses
      6 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Today, 08:42 PM
      0 responses
      8 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Today, 07:51 PM
      0 responses
      9 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,975 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      9 views
      0 likes
      Last Post rbeckmann05  
      Working...
      X