Here is a turtletrader code I have been playing around with. It not perfect as there are huge drawbacks, but it has even larger profits. It also need a decent amount of capital to begin with- a lot of patience and stomach ice.
There are many 0-bar trades but only on the stoploss. Profit bars is 5 so I think the trades are valid and not subjected to the zerobar trade issue so many have written about here.
It makes a trade on 2nd day breakout and adds a trade every day with a minimum SL- many get stopped out but some get going.
I also added some extra trades if there was a trend. I hope you like it. I didn’t clean up the code, so you would see some of the alternative things I have been optimizing.
Comments and improvement are as always welcome.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
//==================DAX Daily Timeframe========================== // Definition of code parameters DEFPARAM CumulateOrders = true // Cumulating positions deactivated //Positionsize=2 // calculate daily high/low Capital = 20000 Risk = 0.005 StopLoss = 20// Could be our variable XREM Calculate contracts equity = Capital + StrategyProfit maxrisk = round(equity*Risk) PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize) if PositionSize>=1000 then PositionSize=1000 endif if PositionSize<=3 then PositionSize=3 endif //ONCE p=0 //x1=1 //x2=16.4 x1=2 x2=20.8 x5=5 SL=6 c1=(highest[x1](close)) if not shortonmarket and high>c1 then BUY Positionsize CONTRACTS AT MARKET //pris=open[p] ENDIF //if open>pris+x5 then if open>tradeprice+x5 then buy Positionsize CONTRACTS AT MARKET endif if longonmarket then CountDays=CountDays+1 //p=p+1 else CountDays=0 //p=0 endif if CountDays>=x2 then sell at market endif set stop loss SL//your SL code //graph (positionsize/equity)*100 COLOURED(0,255,0) AS "RISK"//GREEN //graph (positionsize*SL/equity)*100 COLOURED(0,255,255) AS "MAXRISK"//Aqua //GRAPH tradeprice COLOURED(50,50,75) AS "monthlyHigh" //GRAPH pris COLOURED(50,0,75) AS "pris" |
Cheers Kasper
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Just a small correction. The profit is not taken after 5 bars/days, but 20.8. One way of optimizing further and (perhaps) avoid the huge drawdown is to close partial postions along the way. unfortunate it’s not possible in PRT v. 10.2. anyone know if it will be possible in ver 10.3?
Hi Elsborgtrading,
It’s interesting and I will do some backtest when I have time. Have you tried the strategy on different timeframes, or just daily?
Hi Frank. The initial strategy originated from a 4Week turtletrade breakout with a 1-2 weeks running before taking a profit. That is still profitable, but no way near the gain as for the daily TF. I think I tested it on a several day TF and also 4H timeframe, however there must have been something that showed up that let me not to pursue other timeframes- also the optimization takes a long time, however that not said that it could be profitable on other TF. Let me know what you find out 🙂
note: Before anyone go and invest any real money in this, I think we need to let it run in papertrading demo first, also I don’t think this would be the first automated strategy I would recommend, as it would take a decent amount of capital to begin with. At least 20000 Euros.
Further documentation would involve a Monte Carlo simulation so we could see if we were on the right track. I can find 2 MC sim. tool in this site. I have used them both, they seem to complement each other and produce the same results. First one is based on MS Excel, the other is from tickerquest and completely free. They can both be found here http://www.prorealcode.com/topic/monte-carlo-analysis/#post-12935 Basically what it shows is based on the 1000-3000 runs with all 25 years of exported trades, (aprox. 10200 trades) there should be 0% of a blown account or margin call with 2000 $ to begin the automated system. All simulated and exported trades are done with 1 position and no position sizing as the initial strategy shows. I cannot upload macro enabled or any other “suspicious” files here, so the Excel and sim files must be left out, however I will show the screenshot of the relevant data.
Cheers Kasper
Hello fellow traders. Just to give a status on Demotrade walk forward from 12-09-2016 – 06-12-2016. (Unfortunately ProOrder stopped a while ago and I lost data so I only 3 month of walk forward demo trades)
result
Gain:765 Euro
Running P/L +1120 Euro
I think you are talking about “forward test” (real live trading of your backtested strategy) and not “walk forward” which is an optimisation concept 🙂 Nevermind.
Running P/L screen dump
Hi Nicolas, and thanks for updating the file.
When I backtest the code now I get a completely different equity curve- nothing change with the code. Was there any change to PRT?
Also on the live demo, it closes trades partially- thought it could not be done in Proorder?
Hi Nicolas. I made a mistake. a FTSE chart had sneaked under the DAX and when backtesting I accidently picked the wrong one. That why I got the wrong results. But Still I can see partically closing of positions. I am just in doubt- when trades are accumulated and “set stop Loss x” is reached- it looks like it’s different for each accumulated order entry?
“set stop loss” are individual for each order with IG.
thank you Elsborgtrading
if the strategy were implemented in 2016 it would have defaulted, I guess its because this strategy is killed if implemented during long periods of range trading.
is that right?
Many thanks
Francesco
Hi Francesco, I didn’t test the back test for only 2016, but I guess you are right. However I traded the strategy in demo, and it was just to good to be true. I think around 100% in 6 month. Then I realized that IG demo account allowed the SL=7 at 1 am and the Live account was 10 point. This kills the strategy!
So I been puzzling around this and came up with a new version of code for the turtletrade strategy. Here it is. It is semi automatic. You need start the one name “1st TTradev6.1 Single DAX 1m” code- this need run every day. copy it and name the next 2nd, 3rd and so on. If “1st TTradev6.1 Single DAX 1m” is in marked the next day at 22:00 then start 2nd, and so on. If the previous code, for example 2nd is with loss, stop 3rd, so only codes with profit are running+ one more- in this example 2nd. I do this because I cannot have the best of both worlds when SL is 10 at night. So these codes need to be run at 1 min TF and no accomulating orders. you accomulate by starting the next (2nd) code up. I hope this make sense. Ohh.. and I also tested every single seasonal around the year and implemented that as well. If you want to backtest to 1998, I will provide the “turtletrade-long v3.0 DAX 1D.itf”- file for backtesting purposes. Run this on a 1 day TF. The “1st TTradev6.1 Single DAX 1m.itf” for the strategy I just explained. The v3.0 and V6.1 does not have any indicators that is why it can be comparable. I have also made an indicator that shows when the strategy is hitting an entry that stays in the marked longer than a day.
Cheers Kasper
//-------------------------------------------------------------------------
// Main code : 1st TTradev6.1 Single DAX 1m
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Semi manuel- Proorder needs to be re activated if still running the next day
// all accumolated orders should be stopped manuel after the count of days- or exit of the first Proorder where count of days is automatic
// With saisonal multipliers
//-------------------------------------------------------------------------
//==================DAX Daily Timeframe==========================
// Definition of code parameters
DEFPARAM CumulateOrders = false // Cumulating positions
DEFPARAM PRELOADBARS = 100
//once x2=0
ONCE tradetime=0
ONCE Trutletradedayzerolive=0
//ONCE Trutletradedayonelive=0
//==========================tradeingtime=========================
IF (Time >= 010000 AND Time <= 010100) or (Time >= 230000 AND Time <= 230100) and dayofweek=0 THEN //
Tradetime=1
else
Tradetime=0
endif
//===============================================================
//REM Money Management
Reinvest=1
if reinvest then
Capital = 2000
Risk = 0.2//0.1//in % pr position
StopLoss = 10//7//10 // Could be our variable X
stoploss2=7
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*(Risk/100))
MAXpositionsize=5000
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)/PointValue)*pipsize)))
else
Capital = 2000
Positionsize=1
StopLoss = 10
stoploss2=7
equity = Capital + StrategyProfit
Endif
//oneminutes=1440
//sec=1440*60
//tensec=1440*6
//twentysec=1440*3
oneday=1
dayzero=0
//dayone=oneminutes
//daytwo=oneminutes*2
//daytree=oneminutes*3
//dayfour=oneminutes*4
//dayfive=oneminutes*5
//daysix=oneminutes*6
//dayseven=oneminutes*7
//dayeight=oneminutes*8
//daynine=oneminutes*9
//dayten=oneminutes*10
//dayeleven=oneminutes*11
//daytwelve=oneminutes*12
//daythirteen=oneminutes*13
//dayfourteen=oneminutes*14
//dayfifthteen=oneminutes*15
//daytsixthteen=oneminutes*16
//dayseventeen=oneminutes*17
//dayeightteen=oneminutes*18
//daynineteen=oneminutes*19
//daytwenty=oneminutes*20
//daytwentyone=oneminutes*21
//daytwentytwo=oneminutes*22
//daytwentytree=oneminutes*23
//daytwentyfour=oneminutes*24
//daytwentyfive=oneminutes*25
//daytwentysix=oneminutes*26
//daytwentyseven=oneminutes*27
//daytwentyeight=oneminutes*28
//daytwentynine=oneminutes*29
//daythirty=oneminutes*30
//daythirtyone=oneminutes*31
factor=oneday//oneminutes// minutes a day* sec a minute
// define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
ONCE January1 = 2//f4
ONCE January2 = 2//f4
ONCE February1 = 0//f4
ONCE February2 = 2//f4
ONCE March1 = 2//f4
ONCE March2 = 3//f4
ONCE April1 = 3//f4
ONCE April2 = 2//f4
ONCE May1 = 0//f4//..//dont trade
ONCE May2 = 3//f4
ONCE June1 = 0//f4//don\'t trade//dont trade
ONCE June2 = 0//f4//..//dont trade
ONCE July1 = 3//f4
ONCE July2 = 0//f4//don\'t trade
ONCE August1 = 1//f4//don\'t trade//don\'t trade
ONCE August2 = 0//f4//don\'t trade//dont trade
ONCE September1 = 0//f4//don\'t trade//??
ONCE September2 = 0//f4//..//dont trade
ONCE October1 = 3//f4
ONCE October2 = 2//f4
ONCE November1 = 2//f4
ONCE November2 = 3//f4
ONCE December1 = 2//f4
ONCE December2 = 3//0//f4
// set saisonal multiplier
currentDayOfTheMonth = Date - ((CurrentYear * 10000) + CurrentMonth * 100)
midOfMonth = 15
IF CurrentMonth = 1 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = January1
x2=29*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = January2
x2=29*factor
ENDIF
ELSIF CurrentMonth = 2 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = February1
x2=21*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = February2
x2=23*factor
ENDIF
ELSIF CurrentMonth = 3 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = March1
x2=30*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = March2
x2=21*factor
ENDIF
ELSIF CurrentMonth = 4 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = April1
x2=30*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = April2
x2=30*factor
ENDIF
ELSIF CurrentMonth = 5 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = May1
x2=26*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = May2
x2=14*factor
ENDIF
ELSIF CurrentMonth = 6 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = June1
x2=30*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = June2
x2=25*factor
ENDIF
ELSIF CurrentMonth = 7 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = July1
x2=27*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = July2
x2=10*factor
ENDIF
ELSIF CurrentMonth = 8 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = August1
x2=23*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = August2
x2=28*factor
ENDIF
ELSIF CurrentMonth = 9 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = September1
x2=15*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = September2
x2=23*factor
ENDIF
ELSIF CurrentMonth = 10 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = October1
x2=30*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = October2
x2=21*factor//f2//29//21
ENDIF
ELSIF CurrentMonth = 11 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = November1
x2=30*factor
ENDIF
IF not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = November2
x2=25*factor
ENDIF
ELSIF CurrentMonth = 12 THEN
IF not onmarket and currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = December1
x2=24*factor
ENDIF
if not onmarket and currentDayOfTheMonth > midOfMonth THEN
saisonalPatternMultiplier = December2
x2=11*factor
ENDIF
ENDIF
//=========================enter turtletrade day one====================================
if BARINDEX-TRADEINDEX(1)>=dayzero or Trutletradedayzerolive then
if not onmarket and Tradetime then
BUY Positionsize * saisonalPatternMultiplier CONTRACTS AT MARKET
ENDIF
if onmarket then
Trutletradedayzerolive=1
else
Trutletradedayzerolive=0
endif
//===========================STOPLOSS CODE===================
//Initial stoploss set
once slmove1=0
once slmove2=0
once sellprice=0
if not slmove1 then
set stop loss StopLoss
slmove1=1
endif
//************move stoploss if gain+3
if slmove1 and longonmarket and close-tradeprice>=(pipsize*pointvalue*3) then
sellprice=tradeprice-(stoploss2*pipsize*pointvalue)
SELL AT sellprice STOP
slmove2=1
endif
if slmove2 then
SELL AT sellprice STOP
endif
//*************try and SL at -7
if longonmarket and close-tradeprice<=-(pipsize*pointvalue*stoploss2) then
sell AT MARKET
endif
if not onmarket then
slmove1=0
slmove2=0
sellprice=0
endif
endif
//======================================================================================
//=========================enter turtletrade day two====================================
//
//if (BARINDEX-TRADEINDEX(1)>=dayone and BARINDEX-TRADEINDEX(1)<daytwo) or Trutletradedayonelive then
//if onmarket and Tradetime then
//BUY Positionsize * saisonalPatternMultiplier CONTRACTS AT MARKET
//ENDIF
//
//if onmarket and +countofposition[1]<+countofposition then
//Trutletradedayonelive=1
//else
//Trutletradedayonelive=0
//endif
//
////===========================STOPLOSS CODE===================
//
////Initial stoploss set
//once slmovedaytwo1=0
//once slmovedaytwo2=0
//once sellpricedaytwo=0
//if not slmovedaytwo1 then
//set stop loss StopLoss
//slmovedaytwo1=1
//endif
//
////************move stoploss if gain+3
//
//if slmovedaytwo1 and longonmarket and close-tradeprice>=(pipsize*pointvalue*3) then
//sellpricedaytwo=tradeprice-(stoploss2*pipsize*pointvalue)
//SELL AT sellpricedaytwo STOP
//slmovedaytwo2=1
//endif
//
//if slmovedaytwo2 then
//SELL AT sellpricedaytwo STOP
//endif
////*************try and SL at -7
////if longonmarket and close-tradeprice<=-(pipsize*pointvalue*stoploss2) then
////sell AT MARKET
////endif
//
//if not onmarket then
//slmovedaytwo1=0
//slmovedaytwo2=0
//sellpricedaytwo=0
//endif
//endif
//=======================================================================================
//=================================counting days in market on a 1 min TF=====
once CountDays=0
if onmarket and (CurrentHour crosses over 01) then//
CountDays=CountDays+1
elsif not onmarket then
CountDays=0
endif
//x2=x2
//===================EXIT ALL POSITIONS=====
//if x2>=x2 then
if CountDays>=x2 then
sell at market
endif
//=========================================
//============1st build in Quit code======
//if not onmarket and equity[1] < equity then
//quit
//endif
//======================================
//maxriskbuy=abs((+countoFPOSITION*stoploss*pipsize*pointvalue/equity)*100)
//graph (((tradeprice-(tradeprice-(tradeprice*(StopLoss/100))))*+countoFPOSITION*pipsize*pointvalue)/(equity))*100 COLOURED(0,0,0) AS \"MAXRISK\"//blue
//graph (positionsize/equity)*100 COLOURED(0,255,0) AS \"RISK\"//GREEN
//graph (+countofposition*StopLoss/equity)*100 COLOURED(0,0,0) AS \"MAXRISK\"//Aqua
//graph abs((+countoFPOSITION*StopLoss*pipsize*pointvalue/equity)*100) COLOURED(255,20,147) AS \"MAXRISK%\"
//GRAPH tradeprice COLOURED(50,50,75) AS \"monthlyHigh\"
//GRAPH pris COLOURED(50,0,75) AS \"pris\"
//GRAPH c1 COLOURED(50,0,75) AS \"c1\"
//===============Graphs RR, Winnings, Max recorded risk, Max risk%
//ONCE maxriskrecorded=0
//If onmarket then
//maxriskrecorded=ABS((+countoFPOSITION*stoploss*pipsize*pointvalue/equity)*100)
//if maxriskrecorded<maxriskrecorded[1]then
//maxriskrecorded=maxriskrecorded[1]
//else
//maxriskrecorded=maxriskrecorded
//endif
//endif
//if not onmarket then
//winnings=StrategyProfit-StrategyProfit[1]
//else
//winnings=0
//endif
//riskprtrade=abs(+countoFPOSITION*stoploss*pipsize)
//RR=winnings/riskprtrade[1]
//graph abs((+countoFPOSITION*stoploss*pipsize*pointvalue/equity)*100) COLOURED(255,20,147) AS \"MAXRISK%\"
//graph maxriskrecorded COLOURED(255,0,255) AS \"MAXrisk%recorded\"
//graph RR COLOURED(0,0,255) AS \"RR\"
//graph winnings COLOURED(0,0,0) AS \"Winnings\"
//graph winnings COLOURED(0,0,0) AS \"Winnings\"
//graph winnings COLOURED(0,0,0) AS \"Winnings\"
//graph slmove1 COLOURED(0,0,0) AS \"slmove\"
//graph slmove2 COLOURED(0,0,0) AS \"slmove2\"
//graph BARINDEX-TRADEINDEX(1)COLOURED(0,0,0) AS \"+countofdays\"
//graph x2 COLOURED(0,0,0) AS \"x2\"
//graph countdays COLOURED(0,0,0) AS \"countdays\"
I cannot provide more files to the post so the backtesting 1D tf code is
//-------------------------------------------------------------------------
// Main code : turtletrade-long v3.0 1D
// With saisonal multipliers- and for backtesting and optimizing saisonal
/7 Spread = 2 SL 7
//-------------------------------------------------------------------------
//==================DAX Daily Timeframe==========================
// Definition of code parameters
DEFPARAM CumulateOrders = true // Cumulating positions
DEFPARAM PRELOADBARS = 100
tradeingweek = OpenDayOfWeek <=5
//REM Money Management
Reinvest=1
if reinvest then
Capital = 20000
Risk = 0.23//0.1//in % pr position
StopLoss = 7//7//10 // Could be our variable X
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*(Risk/100))
MAXpositionsize=5000
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)/PointValue)*pipsize)))
else
Positionsize=1
StopLoss = 7
Endif
// define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
ONCE January1 = 2//f4
ONCE January2 = 2//f4
ONCE February1 = 0//f4
ONCE February2 = 2//f4
ONCE March1 = 2//f4
ONCE March2 = 3//f4
ONCE April1 = 3//f4
ONCE April2 = 2//f4
ONCE May1 = 0//f4//dont trade
ONCE May2 = 3//f4
ONCE June1 = 0//f4//don\'t trade
ONCE June2 = 0//f4//dont trade
ONCE July1 = 3//f4
ONCE July2 = 0//f4//don\'t trade
ONCE August1 = 1//f4//don\'t trade
ONCE August2 = 0//f4//don\'t trade
ONCE September1 = 0//f4//don\'t trade
ONCE September2 = 0//f4//dont trade
ONCE October1 = 3//f4
ONCE October2 = 2//f4
ONCE November1 = 2//f4
ONCE November2 = 3//f4
ONCE December1 = 2//f4
ONCE December2 = 3//f4
// set saisonal multiplier
currentDayOfTheMonth = Date - ((CurrentYear * 10000) + CurrentMonth * 100)
midOfMonth = 15
IF CurrentMonth = 1 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = January1
x2=29//f2//27//29
x5=5//f3//5//5
ELSE
saisonalPatternMultiplier = January2
x2=29//f2//12//29
x5=5//f3//6//5
ENDIF
ELSIF CurrentMonth = 2 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = February1
x2=21//f2//23//21
x5=7//f3//7//7
ELSE
saisonalPatternMultiplier = February2
x2=23//f2//30//23
x5=4//f3//2//4
ENDIF
ELSIF CurrentMonth = 3 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = March1
x2=30//f2//28//30
x5=1//f3//8//1
ELSE
saisonalPatternMultiplier = March2
x2=21//f2//28//21
x5=5//f3//6//5
ENDIF
ELSIF CurrentMonth = 4 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = April1
x2=30//f2//22//30
x5=5//f3//4//5
ELSE
saisonalPatternMultiplier = April2
x2=30//f2//11//30
x5=5//f3//2//5
ENDIF
ELSIF CurrentMonth = 5 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = May1
x2=26//f2//23//26(dont trade)
x5=2//f3//9//2(dont trade)
ELSE
saisonalPatternMultiplier = May2
x2=14//f2//13//14
x5=5//f3//2//5
ENDIF
ELSIF CurrentMonth = 6 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = June1
x2=30//f2//26//don\'t trade//30-dont trade
x5=10//f3//10//don\'t trade10-dont trade
ELSE
saisonalPatternMultiplier = June2
x2=25//f2//30//25-dont trade
x5=4//f3//2//4-dont trade
ENDIF
ELSIF CurrentMonth = 7 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = July1
x2=27//f2//13//27
x5=2//f3//6//2
ELSE
saisonalPatternMultiplier = July2
x2=10//f2//don\'t trade//10-dont trade
x5=5//f3//don\'t trade//5-dont trade
ENDIF
ELSIF CurrentMonth = 8 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = August1
x2=23//f2//don\'t trade//23
x5=4//f3//don\'t trade//4
ELSE
saisonalPatternMultiplier = August2
x2=28//f2//don\'t trade//28-dont trade
x5=8//f3//don\'t trade//8-dont trade
ENDIF
ELSIF CurrentMonth = 9 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = September1
x2=15//f2//don\'t trade//15
x5=2//f3//don\'t trade//2
ELSE
saisonalPatternMultiplier = September2
x2=23//f2//29//23-??
x5=5//f3//9//5-??
ENDIF
ELSIF CurrentMonth = 10 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = October1
x2=30//f2//27//30
x5=3//f3//2//3
ELSE
saisonalPatternMultiplier = October2
x2=21//f2//29//21
x5=5//f3//7//5
ENDIF
ELSIF CurrentMonth = 11 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = November1
x2=30//f2//25//30
x5=5//f3//4//5
ELSE
saisonalPatternMultiplier = November2
x2=25//f2//26//25
x5=3//f3//8//3
ENDIF
ELSIF CurrentMonth = 12 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = December1
x2=24//f2//26//24
x5=5//f3//9//5
ELSE
saisonalPatternMultiplier = December2
x2=11//f2//..//11
x5=5//f3//..//5
ENDIF
ENDIF
//c1=high>(highest[x1](close))
if not shortonmarket and tradeingweek then
BUY Positionsize * saisonalPatternMultiplier CONTRACTS AT MARKET
//pris=open[p]
ENDIF
//if open>pris+x5 then
if open>tradeprice+x5 and tradeingweek then
buy Positionsize *saisonalPatternMultiplier CONTRACTS AT MARKET
endif
if longonmarket then
CountDays=CountDays+1
//p=p+1
else
CountDays=0
//p=0
endif
if CountDays>=x2 and tradeingweek then
sell at market
endif
//maxriskbuy=abs((COUNTOFPOSITION*stoploss*pipsize*pointvalue/equity)*100)
set stop loss StopLoss//your StopLoss code
//graph (((tradeprice-(tradeprice-(tradeprice*(StopLoss/100))))*COUNTOFPOSITION*pipsize*pointvalue)/(equity))*100 COLOURED(0,0,0) AS \"MAXRISK\"//blue
//graph (positionsize/equity)*100 COLOURED(0,255,0) AS \"RISK\"//GREEN
//graph (countofposition*StopLoss/equity)*100 COLOURED(0,0,0) AS \"MAXRISK\"//Aqua
//graph abs((COUNTOFPOSITION*StopLoss*pipsize*pointvalue/equity)*100) COLOURED(255,20,147) AS \"MAXRISK%\"
//GRAPH tradeprice COLOURED(50,50,75) AS \"monthlyHigh\"
//GRAPH pris COLOURED(50,0,75) AS \"pris\"
//GRAPH c1 COLOURED(50,0,75) AS \"c1\"
//===============Graphs RR, Winnings, Max recorded risk, Max risk%
//ONCE maxriskrecorded=0
//If onmarket then
//maxriskrecorded=ABS((COUNTOFPOSITION*stoploss*pipsize*pointvalue/equity)*100)
//if maxriskrecorded<maxriskrecorded[1]then
//maxriskrecorded=maxriskrecorded[1]
//else
//maxriskrecorded=maxriskrecorded
//endif
//endif
//if not onmarket then
//winnings=StrategyProfit-StrategyProfit[1]
//else
//winnings=0
//endif
//riskprtrade=abs(COUNTOFPOSITION*stoploss*pipsize)
//RR=winnings/riskprtrade[1]
//graph abs((COUNTOFPOSITION*stoploss*pipsize*pointvalue/equity)*100) COLOURED(255,20,147) AS \"MAXRISK%\"
//graph maxriskrecorded COLOURED(255,0,255) AS \"MAXrisk%recorded\"
//graph RR COLOURED(0,0,255) AS \"RR\"
//graph winnings COLOURED(0,0,0) AS \"Winnings\"
The indicator code:
atr = averagetruerange[10](close)*0.5
//tradeingweek = OpenDayOfWeek <=5 // and opendayofweek>=1
tradeingweek = OpenDayOfWeek <=5
x1=2
c1=(highest[x1](close))
if high>c1 and open<=low+7 and tradeingweek then
DRAWTEXT(\"Turtletrade DAX\", barindex, high[1]+atr*3, Dialog, Standard, 12) COLOURED(0,0,0)
DRAWARROWUP(barindex,high[1]-atr*3) COLOURED(0,0,0)
endif
Return
Indicator code does not show up on sundays. This is a bug in PRT 10.3
Thank you very much Kasper for your long and detailed answer
I’ll have a look to it, it sounds very promising!
Cheers
Francesco
I think it is, but it takes guts and patience because the winning rate is low, but potential gain is very high. backtest for ver 3.0 therefore 6.1 is out of this world.
Hi Kasper,
so let me see if I understand.
at day 1 you run the “1st TTradev6.1 Single DAX 1m\"at day 2 you run BOTH 1st TTradev6.1 Single DAX 1m AND 2nd TTradev6.1 Single DAX 1m
if at the end of the day the 2nd is at loss, then you stop it and you dont turn it on ever more, and the day after you start the 3rd.
So in this framework the 3rd day you will have the 1st and the 3d and so on ..
Am I right?
Many thanks
Francesco
No that is wrong 🙂 1st runs always- then only run 2nd if 1st is on market with positions(around 22 pm). Run 3rd if 1st and 2nd is on market with positions-… run (n-th) ver if (n-1-th) ver is on market with positions. If 2nd and 3rd closes all positions- then close 3rd. 1st should be still be on market- so 1st and 2nd is running. If 1st closed all positions. Close 2nd so only 1 st run. Goes for 1st to (n)th versions. Hope it makes sense. 🙂
It can only be fully automated if
IG change minimum SLto 7 at night on DAX
multi timeframe support AND allowing partial close of positions
A small example. the strategy would have opened 3 position on Dec 4th 2016 and keept it for 24 days closing on 3rd jan 2017 , Also opened 3 pos on wed 9th dec- closing 3rd jan 2017- thats 3*1195 pips + 3*768 pips- costing 22*3*7 pips= more or less 5420 pips gain- of cause it might just be a lucky shoot 😉