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 nandhumca, Today, 03:41 PM
      0 responses
      4 views
      0 likes
      Last Post nandhumca  
      Started by The_Sec, Today, 03:37 PM
      0 responses
      3 views
      0 likes
      Last Post The_Sec
      by The_Sec
       
      Started by GwFutures1988, Today, 02:48 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      6 responses
      33 views
      0 likes
      Last Post ScottWalsh  
      Started by frankthearm, Today, 09:08 AM
      10 responses
      36 views
      0 likes
      Last Post frankthearm  
      Working...
      X