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

Break even does not work in tick based strategies

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

    Break even does not work in tick based strategies

    I have a strategy that works in minute based charts and in tick based charts.
    In the minute based charts the Break even and Trailing Stop works fine (Calculate on bar close = false).
    However, when I let the strategy work in a tick based chart, the strategy itself works good but the Break even and Trailing Stop don't work.The Stoploss and Profit target works good.

    I already looked at my strategy code but couldn't find any reason for this behavior.
    Is there a general reason for this or should I dive deeper into my code?

    #2
    Hello trail and thank you for your question.

    Some general things to look out for when using SetProfitTarget, SetStopLoss, and SetTrailStop, are as follows.

    • SetStopLoss and SetTrailStop should not be used together. In situations where you would like to, SetStopLoss should be used in both the Initialize/State.Configure section, and again in OnBarUpdate to control trailing behavior
    • All three of these methods only submit orders on the primary bars series. If you need to place orders on secondary bars series and beyond, you should instead use methods with Exit in the name, such as ExitLongLimit and ExitLongStopLimit
    • As a debugging step, if your strategy uses signals, it may be good to reduce your strategy to a single stage strategy that does not use signals. Once this strategy works correctly you can then reintroduce one stage at a time until your strategy works correctly.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      I use the SetStopLoss only in the Initialize and in the OnBarUpdate sections.
      I don't use a SetTrailStop. That is, not the standard one. But I made my own Trail with the use of a changing SetStopLoss.
      And I don't use secondary bars series in this strategy.

      So I understand there is no other particular reason. If it works in Minute charts, then it should also work in Tick based charts, correct?

      Comment


        #4
        And I guess that in for instance a renko chart, an OnBarUpdate is also called with every tick?

        Comment


          #5
          It will be easier to answer questions about strategies not producing expected results if we could answer as many of the following questions as possible. Could you take a few minutes to review these questions? I am happy to explain further any of the below questions and the rationale behind asking them.


          • Do you see expected results when running the same test environment on the SampleMaCrossOver strategy in NinjaTrader with a 3 and 14 period?
            • By expected results, I mean that the SampleMACrossover places trades whenever a 3 and 14 period SMA cross
          • Who are you connected to? This is displayed in green on lower left corner of the Control Center window.
          • Are you connected to your data feed provider when running this test?
          • What instrument(s) (and expiry if applicable) have you selected?
          • What Data Series Type have you selected? Example: Tick, Minute, Day
          • What From and To date is selected?
          • Is your strategy a multi instrument or multi time frame strategy?
          • Do you receive an error on screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            We understand your time is valuable. The attached educational sample has been tested on Renko bars. Please let us know if there are any other ways we can help.
            Attached Files
            Jessica P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 05-06-2023, 09:03 PM
            10 responses
            262 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by michi08, 10-05-2018, 09:31 AM
            5 responses
            741 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by The_Sec, Today, 02:29 PM
            0 responses
            2 views
            0 likes
            Last Post The_Sec
            by The_Sec
             
            Started by tsantospinto, 04-12-2024, 07:04 PM
            4 responses
            62 views
            0 likes
            Last Post aligator  
            Started by sightcareclickhere, Today, 01:55 PM
            0 responses
            1 view
            0 likes
            Last Post sightcareclickhere  
            Working...
            X