Donchian Channels Trading Strategy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #150733 quote
    kalleklovn
    Participant
    Junior

    Hi can some one help me code this as you can not use the Donchain channels for trading in proreal time.

    I have a youtube link explaining the strat https://www.youtube.com/watch?v=icYe2SS3-4M

    But if you dont want to watch it and read her it goes.

    You use the 200EMA as a filter from when to buy and sell. Price under only sell price over only buy.

    Then you want to buy when the Donchian Channels make a new high with the stop loss below the lower Donchian Channels low.

    i would also want a trailstopploss to follow the lower band.

    The opposite goes for sell.

     

    Hope some one understands and can help. let me know if something is unclear.

    Have a nice day and happy trading:)

    #150739 quote
    robertogozzi
    Moderator
    Master

    There you go (not tested):

    Defparam CumulateOrders = false
    N             = 40
    LookBack      = 50
    UpperDonchian = highest[N](high)
    LowerDonchian = lowest[N](low)
    Sma200        = average[200,0](close)
    L1            = close > Sma200
    S1            = close < Sma200
    L2            = UpperDonchian < UpperDonchian[1]
    S2            = LowerDonchian > LowerDonchian[1]
    L3            = UpperDonchian[1] = highest[LookBack](UpperDonchian[1])
    S3            = LowerDonchian[1] = lowest[LookBack](LowerDonchian[1])
    Lcond         = L1 and L2 and L3
    Scond         = S1 and S2 and S3
    If Not OnMarket then
       NewSL = 0
    Else
       If PositionPerf > 0 Then
          If LongOnMarket then
             NewSL = max(NewSL, LowerDonchian)
          Else
             NewSL = min(NewSL, UpperDonchian)
          Endif
       Endif
    Endif
    If Lcond and Not OnMarket then
       Buy 1 contract at Market
       Set stop Loss abs(close - LowerDonchian[1])
       Set Target pProfit 200
    Endif
    If Scond and Not OnMarket then
       Sellshort 1 contract at Market
       Set stop Loss abs(close - UpperDonchian[1])
       Set Target pProfit 200
    Endif
    If OnMarket and NewSL > 0 then
       Sell      at NewSL Stop
       Exitshort at NewSL Stop
    Endif
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Donchian Channels Trading Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kalleklovn @kalleklovn Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
5 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/17/2020
Status: Active
Attachments: No files
Logo Logo
Loading...