Announcement

Collapse
No announcement yet.

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

    Comment


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

      Comment


        #4
        Hi all,

        I tried to run the DonchianStrategyExample on a 1440min chart but it doesn't take any trade in backtest.

        The same strategy applied to a daily chart it is working without problem.

        I am doing something wrong?

        Thank you.

        Comment


          #5
          Hello Peppo,

          If there are no trades that would mean the condition to enter is not becoming true due to the values that are being used in the condition. To know exactly why that's happening in that specific use case you can add a Print and also turn on Trace Orders to check what is happening. In a new set with no conditions you can add the action of Misc -> Print and then output the bar time, close price and Donchian value. That will let you see what the close price and Donchian price are for every bar to know why it is not becoming true.

          Comment


            #6
            Hi Jesse,

            thanks for your answer.

            I have already added some prints inside the condition to see if it is verified and actually it is but no trade is taken.

            On the daily chart the trades are taken. How is it possible?

            Comment


              #7
              Hello Peppo,

              Have you tried enabling trace orders to see if the orders are being ignored? In the builder this can be enabled under the default properties section.

              Comment


                #8
                Hi Jesse,

                I had to delete my database and now is working.

                Thanks.
                Regards

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                572 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                331 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                549 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                550 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X