A simple code with differently weighted averages and a stop by repulse.
Supplemented by the seasonal pattern multiplier and a re-invest strategy.
If necessary, the latter can also be omitted, but it still remains a gain that achieves a higher performance than the Dax itself.
Time conditions should be adapted to your timezone. Timeframe = H4.
You can also do without the fixed TP and SL. The insurance can stay.
// MainCode : DailyOpenLong
// Dax 1 Euro
// TimeFrame4H
// created by JohnScher
// with SainsonalPatternMultiplier from Pathfinder-Systems
// with Re-Invest-Strategie
//..............................................................
// Start
//..............................................................
defparam cumulateorders = false
// saisonal pattern muliplier
ONCE January1 = 3 //0 risk(3)
ONCE January2 = 0 //3 ok
ONCE February1 = 3 //3 ok
ONCE February2 = 3 //0 risk(3)
ONCE March1 = 3 //0 risk(3)
ONCE March2 = 2 //3 ok
ONCE April1 = 3 //3 ok
ONCE April2 = 3 //3 ok
ONCE May1 = 1 //0 risk(1)
ONCE May2 = 1 //0 risk(1)
ONCE June1 = 1 //1 ok 2
ONCE June2 = 2 //3 ok
ONCE July1 = 3 //1 chance
ONCE July2 = 2 //3 ok
ONCE August1 = 2 //1 chance 1
ONCE August2 = 3 //3 ok
ONCE September1 = 3 //0 risk(3)
ONCE September2 = 0 //0 ok
ONCE October1 = 3 //0 risk(3)
ONCE October2 = 2 //3 ok
ONCE November1 = 1 //1 ok
ONCE November2 = 3 //3 ok
ONCE December1 = 3 // 1 chance
ONCE December2 = 2 //3 ok
// set saisonal multiplier
currentDayOfTheMonth = Day
midOfMonth = 15
IF CurrentMonth = 1 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = January1
ELSE
saisonalPatternMultiplier = January2
ENDIF
ELSIF CurrentMonth = 2 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = February1
ELSE
saisonalPatternMultiplier = February2
ENDIF
ELSIF CurrentMonth = 3 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = March1
ELSE
saisonalPatternMultiplier = March2
ENDIF
ELSIF CurrentMonth = 4 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = April1
ELSE
saisonalPatternMultiplier = April2
ENDIF
ELSIF CurrentMonth = 5 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = May1
ELSE
saisonalPatternMultiplier = May2
ENDIF
ELSIF CurrentMonth = 6 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = June1
ELSE
saisonalPatternMultiplier = June2
ENDIF
ELSIF CurrentMonth = 7 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = July1
ELSE
saisonalPatternMultiplier = July2
ENDIF
ELSIF CurrentMonth = 8 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = August1
ELSE
saisonalPatternMultiplier = August2
ENDIF
ELSIF CurrentMonth = 9 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = September1
ELSE
saisonalPatternMultiplier = September2
ENDIF
ELSIF CurrentMonth = 10 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = October1
ELSE
saisonalPatternMultiplier = October2
ENDIF
ELSIF CurrentMonth = 11 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = November1
ELSE
saisonalPatternMultiplier = November2
ENDIF
ELSIF CurrentMonth = 12 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = December1
ELSE
saisonalPatternMultiplier = December2
ENDIF
Endif
// end sainsonal pattern multiplier
// code re-invest
Capital = 10000
Equity = Capital + StrategyProfit
Position = Max(1, Equity * (1/Capital))
Position = Round(Position*100)
Position = Position/100
// start maincode
TradingDayLong = dayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5
TradingtimeLong = time = 080000 //or time = 130000 or time = 170000
c1 = TR (close) > 25
c2 = TEMA [4] (close) > ExponentialAverage [4] (close)
IF TradingDayLong and TradingTimeLong Then
If c1 and c2 THEN
buy position*saisonalpatternmultiplier CONTRACT AT MARKET
Endif
ENDIF
// set stop loss
IF time = 080000 or time = 120000 or time = 160000 or time = 200000 then
If Repulse[3](close)< -0.3 Then
sell at market
Endif
ENDIF
// set target profit set stop loss
//set target %profit 3
Set stop %loss 5
// end maincode
kind regards
You must be logged in to post a comment.
TradingDayLong = dayofweek = 1 or dayofweek = 2 or dayofweek = 3 or dayofweek = 4 or dayofweek = 5 TradingtimeLong = time > 075900 and time 25 c2 = TEMA [4] (close) > ExponentialAverage [4] (close) IF TradingDayLong and TradingTimeLong Then If c1 and c2 THEN buy position*saisonalpatternmultiplier CONTRACT AT MARKET Endif ENDIF // set stop loss If Repulse[3](close)< -0.3 Then sell at market Endif // set target profit set stop loss set target %profit 3 Set stop %loss 5 // end maincode
this one runs // MainCode : DailyOpenLong // Dax 1 Euro // TimeFrame4H // created by JohnScher // with SainsonalPatternMultiplier from Pathfinder-Systems // with Re-Invest-Strategie //.............................................................. // Start //.............................................................. defparam cumulateorders = false // saisonal pattern muliplier ONCE January1 = 3 //0 risk(3) ONCE January2 = 0 //3 ok ONCE February1 = 3 //3 ok ONCE February2 = 3 //0 risk(3) ONCE March1 = 3 //0 risk(3) ONCE March2 = 2 //3 ok ONCE April1 = 3 //3 ok ONCE April2 = 3 //3 ok ONCE May1 = 1 //0 risk(1) ONCE May2 = 1 //0 risk(1) ONCE June1 = 1 //1 ok 2 ONCE June2 = 2 //3 ok ONCE July1 = 3 //1 chance ONCE July2 = 2 //3 ok ONCE August1 = 2 //1 chance 1 ONCE August2 = 3 //3 ok ONCE September1 = 3 //0 risk(3) ONCE September2 = 0 //0 ok ONCE October1 = 3 //0 risk(3) ONCE October2 = 2 //3 ok ONCE November1 = 1 //1 ok ONCE November2 = 3 //3 ok ONCE December1 = 3 // 1 chance ONCE December2 = 2 //3 ok // set saisonal multiplier currentDayOfTheMonth = Day midOfMonth = 15 IF CurrentMonth = 1 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = January1 ELSE saisonalPatternMultiplier = January2 ENDIF ELSIF CurrentMonth = 2 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = February1 ELSE saisonalPatternMultiplier = February2 ENDIF ELSIF CurrentMonth = 3 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = March1 ELSE saisonalPatternMultiplier = March2 ENDIF ELSIF CurrentMonth = 4 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = April1 ELSE saisonalPatternMultiplier = April2 ENDIF ELSIF CurrentMonth = 5 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = May1 ELSE saisonalPatternMultiplier = May2 ENDIF ELSIF CurrentMonth = 6 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = June1 ELSE saisonalPatternMultiplier = June2 ENDIF ELSIF CurrentMonth = 7 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = July1 ELSE saisonalPatternMultiplier = July2 ENDIF ELSIF CurrentMonth = 8 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = August1 ELSE saisonalPatternMultiplier = August2 ENDIF ELSIF CurrentMonth = 9 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = September1 ELSE saisonalPatternMultiplier = September2 ENDIF ELSIF CurrentMonth = 10 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = October1 ELSE saisonalPatternMultiplier = October2 ENDIF ELSIF CurrentMonth = 11 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = November1 ELSE saisonalPatternMultiplier = November2 ENDIF ELSIF CurrentMonth = 12 THEN IF currentDayOfTheMonth 25 c2 = TEMA [4] (close) > ExponentialAverage [4] (close) IF TradingDayLong and TradingTimeLong Then If c1 and c2 THEN buy position*saisonalpatternmultiplier CONTRACT AT MARKET Endif ENDIF // set stop loss IF time = 090000 or time = 130000 or time = 170000 or time = 210000 then If Repulse[3](close)< -0.3 Then sell at market Endif ENDIF // set target profit set stop loss //set target %profit 3 Set stop %loss 5 // end maincode // end
next try doesn´t work so here it is // MainCode : DailyOpenLong // Dax 1 Euro // Timezone GMT // TimeFrame4H // created by JohnScher // with SainsonalPatternMultiplier from Pathfinder-Systems // with Re-Invest-Strategie //.............................................................. // Start //.............................................................. defparam cumulateorders = false // saisonal pattern muliplier ONCE January1 = 3 //0 risk(3) ONCE January2 = 0 //3 ok ONCE February1 = 3 //3 ok ONCE February2 = 3 //0 risk(3) ONCE March1 = 3 //0 risk(3) ONCE March2 = 2 //3 ok ONCE April1 = 3 //3 ok ONCE April2 = 3 //3 ok ONCE May1 = 1 //0 risk(1) ONCE May2 = 1 //0 risk(1) ONCE June1 = 1 //1 ok 2 ONCE June2 = 2 //3 ok ONCE July1 = 3 //1 chance ONCE July2 = 2 //3 ok ONCE August1 = 2 //1 chance 1 ONCE August2 = 3 //3 ok ONCE September1 = 3 //0 risk(3) ONCE September2 = 0 //0 ok ONCE October1 = 3 //0 risk(3) ONCE October2 = 2 //3 ok ONCE November1 = 1 //1 ok ONCE November2 = 3 //3 ok ONCE December1 = 3 // 1 chance ONCE December2 = 2 //3 ok // set saisonal multiplier currentDayOfTheMonth = Day midOfMonth = 15 IF CurrentMonth = 1 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = January1 ELSE saisonalPatternMultiplier = January2 ENDIF ELSIF CurrentMonth = 2 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = February1 ELSE saisonalPatternMultiplier = February2 ENDIF ELSIF CurrentMonth = 3 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = March1 ELSE saisonalPatternMultiplier = March2 ENDIF ELSIF CurrentMonth = 4 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = April1 ELSE saisonalPatternMultiplier = April2 ENDIF ELSIF CurrentMonth = 5 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = May1 ELSE saisonalPatternMultiplier = May2 ENDIF ELSIF CurrentMonth = 6 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = June1 ELSE saisonalPatternMultiplier = June2 ENDIF ELSIF CurrentMonth = 7 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = July1 ELSE saisonalPatternMultiplier = July2 ENDIF ELSIF CurrentMonth = 8 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = August1 ELSE saisonalPatternMultiplier = August2 ENDIF ELSIF CurrentMonth = 9 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = September1 ELSE saisonalPatternMultiplier = September2 ENDIF ELSIF CurrentMonth = 10 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = October1 ELSE saisonalPatternMultiplier = October2 ENDIF ELSIF CurrentMonth = 11 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = November1 ELSE saisonalPatternMultiplier = November2 ENDIF ELSIF CurrentMonth = 12 THEN IF currentDayOfTheMonth 25 c2 = TEMA [4] (close) > ExponentialAverage [4] (close) IF TradingDayLong and TradingTimeLong Then If c1 and c2 THEN buy position*saisonalpatternmultiplier contracts at market Endif ENDIF // condition to exit IF time = 080000 or time = 120000 or time = 160000 or time = 200000 then If Repulse[3](close)< -0.3 Then sell at market Endif ENDIF // set target profit set stop loss //set target %profit 3 Set stop %loss 5 // Stop Loss as an insurace e.g. an exploiting nuclear power plant // end maincode // end all right?
// MainCode: DailyOpenLong // Dax 1 Euro // TimeFrame 4H // created by JohnScher // with SaisonalPatternMultiplier from Pathfinder-Systems // with Re-Invest-Strategie //.............................................................. // Start //.............................................................. defparam cumulateorders = false // saisonal pattern muliplier ONCE January1 = 3 //0 risk(3) ONCE January2 = 0 //3 ok ONCE February1 = 3 //3 ok ONCE February2 = 3 //0 risk(3) ONCE March1 = 3 //0 risk(3) ONCE March2 = 2 //3 ok ONCE April1 = 3 //3 ok ONCE April2 = 3 //3 ok ONCE May1 = 1 //0 risk(1) ONCE May2 = 1 //0 risk(1) ONCE June1 = 1 //1 ok 2 ONCE June2 = 2 //3 ok ONCE July1 = 3 //1 chance ONCE July2 = 2 //3 ok ONCE August1 = 2 //1 chance 1 ONCE August2 = 3 //3 ok ONCE September1 = 3 //0 risk(3) ONCE September2 = 0 //0 ok ONCE October1 = 3 //0 risk(3) ONCE October2 = 2 //3 ok ONCE November1 = 1 //1 ok ONCE November2 = 3 //3 ok ONCE December1 = 3 // 1 chance ONCE December2 = 2 //3 ok // set saisonal multiplier currentDayOfTheMonth = Day midOfMonth = 15 IF CurrentMonth = 1 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = January1 ELSE saisonalPatternMultiplier = January2 ENDIF ELSIF CurrentMonth = 2 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = February1 ELSE saisonalPatternMultiplier = February2 ENDIF ELSIF CurrentMonth = 3 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = March1 ELSE saisonalPatternMultiplier = March2 ENDIF ELSIF CurrentMonth = 4 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = April1 ELSE saisonalPatternMultiplier = April2 ENDIF ELSIF CurrentMonth = 5 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = May1 ELSE saisonalPatternMultiplier = May2 ENDIF ELSIF CurrentMonth = 6 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = June1 ELSE saisonalPatternMultiplier = June2 ENDIF ELSIF CurrentMonth = 7 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = July1 ELSE saisonalPatternMultiplier = July2 ENDIF ELSIF CurrentMonth = 8 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = August1 ELSE saisonalPatternMultiplier = August2 ENDIF ELSIF CurrentMonth = 9 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = September1 ELSE saisonalPatternMultiplier = September2 ENDIF ELSIF CurrentMonth = 10 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = October1 ELSE saisonalPatternMultiplier = October2 ENDIF ELSIF CurrentMonth = 11 THEN IF currentDayOfTheMonth <= midOfMonth THEN saisonalPatternMultiplier = November1 ELSE saisonalPatternMultiplier = November2 ENDIF ELSIF CurrentMonth = 12 THEN IF currentDayOfTheMonth 25 c2 = TEMA [4] (close) > ExponentialAverage [4] (close) c3 = Repulse [3] (close) > 0.3 IF TradingDayLong and TradingTimeLong Then If c1 and c2 and c3 THEN buy position*saisonalpatternmultiplier CONTRACT AT MARKET Endif ENDIF // set stop loss IF time = 090000 or time = 130000 or time = 170000 or time = 210000 then If Repulse[3](close)< -0.3 Then sell at market Endif ENDIF // set target profit set stop loss //set target %profit 3 Set stop %loss 5 // end maincode
@Kv6 Try this code, see below. Please pay attention to the correct time settings. The trade starts at 09:00 GMT+1 or 08:00 GMT. Correspondingly then the closes 09.00/13.00/17.00/21.00 GMT+1 08.00/12.00/16.00/22.00 GMT Here in the code i use GMT+1 Then it should work. If it doesn't work, please use ScreenShots.
JohnScher has requested that I post my very slightly modified version of his strategy that gives better profits and a higher win/loss ratio on here but unfortunately I am unable to post code for some strange reason. Please go to https://www.prorealcode.com/topic/wanted-small-code-snippet/#post-57152 where you can find the new code. You may wish to adjust the SET Target %Profit to 3.75 instead of the 3 that it is as this is a more optimized number.
Bha... this code dont work. gg