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

SetStopLoss Not working

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

    SetStopLoss Not working

    Hi, I have attached the screenshots below.
    - for the second screenshot, it's showed that my stop loss happened after a 3 point drop while within my code I have stated that the stop loss would be 2 points. I was wondering would there be any way that I could fix it, or is it a problem due to the strategy analyzer.
    - For all the trades that the Strategy has entered, I have noticed that all of them exit or stop loss on the next bar. Once again I was wondering would it be because of the simulated environment due to the strategy analyzer or is there another way that I could fix it.
    - My last question is will there be any way I could access the data from the EMA and the SMA. For example, I would want to enter long if the SMA is below my bars and I want the slope of the SMA to be in an incline. Would there be any case that I could access the EMA at each individual bar like you would be able to access a bars close data with Close[0].

    #2
    Hi horace chow,
    The photo seems to suggest that entry during a candle is fine.
    Does exit behaviour change, if you
    - use Calculate.OnPriceChange,
    - use Tick replay,
    - change data series to single tick?
    I'd try one by one, in this order.
    NT-Roland

    Comment


      #3
      Hi, thanks for your question.

      Adding intrabar granularity can improve the fill estimation that is done by the strategy analyzer. Please review this post from our colleague Chelsea that already details this concept:

      https://ninjatrader.com/support/foru...ive#post773377

      Yes its possible to use many indicators in a strategy. We have an example in the platform called "SampleMACrossover" That is a good example of where to start with accessing indicator variables.

      Please let me know if I can assist any further.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        I have tried using Calculate.OnPriceChange, Tick replay, and change data series to single tick, However, it's the same results, some follow the code and exist with stop loss of 2 points but some still exist after 3 points or more.

        Comment


          #5
          Hi horace, thanks for your reply.

          Did you add a smaller time frame to fill your orders on? That can be found in the strategy analyzer settings under "Historical Fill processing". Try adding a 1 Tick series. If you have a reduced test script that I can test I would be happy to do that as well.

          I look forward to hearing from you.
          Chris L.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Stanfillirenfro, Yesterday, 09:19 AM
          7 responses
          51 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by TraderCro, 04-12-2024, 11:36 AM
          4 responses
          69 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Mindset, Yesterday, 02:04 AM
          1 response
          15 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by agclub, 04-21-2024, 08:57 PM
          4 responses
          18 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Irukandji, Today, 04:58 AM
          0 responses
          6 views
          0 likes
          Last Post Irukandji  
          Working...
          X