//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)