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

Donchian Channel Strategy not working intraday

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

    Donchian Channel Strategy not working intraday

    Hello,

    I am trying to create a backtesting strategy for a donchain channel strategy for CL 08-22. I want the system to buy when it closes above the 55 period channel and exit when it closes below the 20 period channel. On the normal charts you can put an offset of 1, but in the strategy I do not see how to do this but I need this for my entries. There is something called displacement but that seems to work differently.

    It buys in very random places and does not sell at my stops nor does it follow my exit strategy. It just exits at the end of day.

    Also, how do I set to only test during normal trading hours of 9-230 EST?


    Thank you!





    #2
    Hello MA_commodities,

    Thank you for your note.

    Displacement simply visually moves the indicator forward on the chart by the displacement number of bars, so what you can do is simply refer to the plot 1 bar ago to mimic that. You cannot apply displacement visually to the indicator from the strategy, however. Offset in a strategy is different, and would add X amount to the value of the indicator/series for that given bar.

    First, however, your stop loss isn't working because you've given it a "From Entry Signal" name of 20 instead of putting 20 in for the value field. So it's not being triggered because you don't have an entry with a Signal Name of "20", and even if you did, you're telling it to put that stop 0 ticks from the entry.

    Are you meaning to reference the Upper plot of the 20 period donchian channel and the lower plot of an 8 period donchian channel the from 256 bars ago? Those don't match between your screenshot and what you've specified in the post.

    I've made a simple example script that demonstrates checking the donchian channel from 1 bar ago and using that for the entry/exit along with a properly configured stop loss. I'm also attaching a script that demonstrates how to set up logic that only allows entries during a specified time period.

    Please let us know if we may be of further assistance to you.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the help! That cleared up all of my questions.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ScottWalsh, Today, 06:52 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by ScottW, Today, 06:09 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by ftsc2022, 10-25-2022, 12:03 PM
      5 responses
      256 views
      0 likes
      Last Post KeyonMatthews  
      Started by Board game geek, 10-29-2023, 12:00 PM
      14 responses
      244 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      4 responses
      56 views
      0 likes
      Last Post sonia0101  
      Working...
      X