Hello Everyone
Here´s my first effort, I hope I´ll get in what needs to be seen and that it´s readable and understandable.
Maybe already published but not found by me. Any opinions, questions, discovered problems or further development is greatly appreciated.
It´s a strategy supposed to have been used by Kevin Daley when he won the Championship some years ago. I´ve seen this at a presentation here not associated with KD. Quit simple strategy really. Unclear what TF and Securities he used.
The rules are(Reversed for short positions):
Uptrend Max 20 bars(Unclear what he used as trend, I use SMA20 and SMA200)
Wick of more than 50% on the upside for longpositions( CSU in code)
Buystop 0,1 ATR above the High of the CSU
Exit conds:50%@ 1 ATR(10) and 50% at 2ATR(10)
Stoploss ATR trailing stop 10, 2
I´ve done some Quick backtests with Swedish stocks seems ok in 60 min TF, but since it´s not really yet doing what I want it to do, I wait until i´ve completed the code with further tests.
I have some issues with it though, which probably affect the results negatively:
1: I want it to buy exactly at 0,1ATR above the high of CSD and not at next Candle Close as it seems to do now, I think that som of the winnings are lost here?
2:Are the SMA:s conditions accurate? I want them to both be up and 20 above 200 at the buying Candle is this true as it´s written now?
3: the i and y respectively could perhaps be optimised I´ve chosen that max 10 bars from the formation of candle to Buy, maybe more or less?
Any other issues that you discover ?
I hope you like it and find it interesting.
//P
//Strategy:KD Championship as presented by Kevin Daley
//Reqs long: 1 CS that closes in lower 50% in an uptrend(Max 20 bars)
// 2 buystop at 0.1 ATR above the Highest of above CS
// 3 exit 50% at 1 ATR(10) the rest at 2ATR(10)
// 4 SL trailing atr 10 multiplier 2
//Mirrored for short positions
//Indicator for CS with long wick in a down or uptrend any of the last 10 days
// identifying the day of the Candlestick and it´s high and low respectively any of the last 10 days
For i=1 to 10 do
CSU=(High[i]-MAX(Close[i],Open[i]))/(High[i]-Low[i])>=0.51
if CSU Then
Ho=High[i]
Break
Endif
Next
For y = 1 to 10 do
CSD=(MIN(Close[y],Open[y])-Low[y])/(High[y]-Low[y])>=0.51
if CSD Then
Lo=Low[y]
Break
Endif
Next
//Indicator of trend
//Have chosen MA20 and MA200 points up and MA20 above Ma200 for uptrend reverse for down
TRENDU1=Average[200](close)[0] > Average[200](close)[1]
TRENDU2=Average[20](close)[0] > Average[20](close)[1]
TRENDU3=Average[200](close)[0] > Average[20](close)[0]
TRENDD1=Average[200](close)[0] < Average[200](close)[1]
TRENDD2=Average[20](close)[0] < Average[20](close)[1]
TRENDD3=Average[20](close)[0] < Average[200](close)[0]
// Conditions to enter long positions
Buycond=close[0]>Ho+0.1*AverageTrueRange[10](close)
Positionsizelong=100
IF NOT LongOnMarket AND TrendU1 and trendu2 and trendu3 and Buycond THEN
BUY Positionsizelong CONTRACTS AT MARKET
ENDIF
// Conditions to exit long positions
Sellcond1=Close[0]>((Positionprice)+AverageTrueRange[14](close))
If LongOnMarket AND Sellcond1 THEN
SELL Positionsizelong/2 CONTRACTS AT MARKET
ENDIF
Sellcond2=Close[0]>(positionprice+2*AverageTrueRange[14](close))
If LongOnMarket AND Sellcond2 THEN
SELL Positionsizelong/2 CONTRACTS AT MARKET
ENDIF
// Conditions to enter short positions
Shortcond=close[0]<(Lo-0.1*AverageTrueRange[10](close))
Positionsizeshort=100
IF NOT ShortOnMarket And Trendd1 and trendd2 and trendd3 and shortcond THEN
SELLSHORT Positionsizeshort CONTRACTS AT MARKET
ENDIF
// Conditions to exit short positions
Shortexitcond1=Close[0]<POSITIONPRICE-AverageTrueRange[14](close)
Shortexitcond2=Close[0]<POSITIONPRICE-2*AverageTrueRange[14](close)
IF ShortOnMarket AND Shortexitcond1 THEN
EXITSHORT Positionsizeshort/2 CONTRACTS AT MARKET
ENDIF//
IF ShortOnMarket AND Shortexitcond2 THEN
EXITSHORT Positionsizeshort/2 CONTRACTS AT MARKET
ENDIF
// Stops and targets : Enter your protection stops and profit targets here
//STOPATRTrail and targets
//Variables
NATR = 10 //ATR Period
SATR = 2 // ATR Multiplier for Stop
//Stop and Target
SET STOP LOSS SATR*AverageTrueRange[NATR](close)