 | Notes for this Trading Account: | This system is based upon the 4 week rule by Richard Donchian. In the original system, the system was always long or short, this system will trade flat when none trending.
Rules: Enter long when the close exceeds the high of the previous 20 bars Exit long when the close falls below the low of the previous 10 bars Enter short when close falls below the low of the previous 20 bars Exit short when the close exceeds the high of the previous 10 bars
 | Rules for this Trading Account: |
 | Notes for this Trading System: |
 | Rules for this Trading System: |
 | Bar event logic: |
#This system is based upon the 4 week rule by Richard Donchian
#In the original system, the system was always long or short, this
#system will trade flat when none trending.
#Rules:
#Enter long when the close exceeds the high of the previous 20 bars
#Exit long when the close falls below the low of the previous 10 bars
#Enter short when close falls below the low of the previous 20 bars
#Exit short when the close exceeds the high of the previous 10 bars
unless (Position) {
#we have no position, perform entry logic
BuyOpen if ClosePrice>Yesterday(Highest(High,20));
SellOpen if ClosePrice<Yesterday(Lowest(Low,20));
}
else {
#We have a position
if (LongPosition) {
#We have a long Position, perform exit logic
SellOpen if ClosePrice<Yesterday(Lowest(Low,10));
}
else {
#We have a short Position, perform exit logic
BuyOpen if ClosePrice>Yesterday(Highest(High,10));
}
}
|