I came across this little system from Juanj here and am falling a little bit off the beaten track. I optimized it to M1 200000bars for the SP500 and added an emergency stop. And then something comes out. Has anyone tried that? Sure, it’s almost always on the market. Do the over-night fees eat up the profit or can you trade something like that live? What do the old hands say?
@juanj: What do you think about it yourself?
///Spread set to 0.9 points
defparam preloadbars = 10000
possize = 1
pointsp = 15 //points where profit is to be locked in //20 SP500
pointsb = 43 //points where stop is to be taken //36 SP500
fast = average[11,4](close) //11
medium = average[14,4](close) //13
If countofposition = 0 then
If fast > medium then
BUY possize CONTRACT AT open + averagetruerange[3](close)*2 stop
EndIf
EndIf
If longonmarket and close >= positionprice + pointsp then
If close < close[1] then
SELL AT MARKET
EndIf
ElsIf longonmarket and close <= positionprice - pointsb then
SELLSHORT possize*2 CONTRACT AT MARKET
EndIf
If shortonmarket and close <= positionprice - pointsp then
If close > close[1] then
EXITSHORT AT MARKET
EndIf
ElsIf shortonmarket and close >= positionprice + pointsb then
BUY possize*2 CONTRACT AT MARKET
EndIf
SET TARGET pPROFIT 16 //50
SET STOP %LOSS 1.1
Ok, the system will stop. Of course, a stop order in the M1 does not work. So the input must also be a market order. At least in the M1.
Most likely the system will stop and every time you have to reactivate it as mentioned in the previous post, but it works well only in the optimized period
Hello
Mauro T.
It’s optimized for M1 SP500, a try. Does this kind of mechanics even make sense? Since I’m not a great programmer, I’ll ask the experts.
Quickly rewritten to a fixed 5 * pip size … that should actually be enough. The picture is similar, only less time on the market.
///Spread set to 0.9 points
defparam preloadbars = 10000
possize = 5
pointsp = 25 //points where profit is to be locked in //20 SP500
pointsb = 45 //points where stop is to be taken //36 SP500
fast = average[11,4](close) //11
medium = average[14,4](close) //13
//If countofposition = 0 then
//If fast > medium then
//BUY possize CONTRACT AT open + averagetruerange[3](close)*2 stop
//EndIf
//EndIf
If countofposition = 0 then
If fast > medium then
BUY possize CONTRACT AT open + 5*pipsize stop
EndIf
EndIf
If longonmarket and close >= positionprice + pointsp then
If close < close[1] then
SELL AT MARKET
EndIf
ElsIf longonmarket and close <= positionprice - pointsb then
SELLSHORT possize*2 CONTRACT AT MARKET
EndIf
If shortonmarket and close <= positionprice - pointsp then
If close > close[1] then
EXITSHORT AT MARKET
EndIf
ElsIf shortonmarket and close >= positionprice + pointsb then
BUY possize*2 CONTRACT AT MARKET
EndIf
SET TARGET pPROFIT 25 //50
SET STOP %LOSS 1.2
Thanks for sharing phoentzs
Here is 1M Backtest. Big drawdowns at long.
The strategy didn’t come from me. The strategy is certainly not robust, rather something that you optimize every month. It cannot manage 1000000bars for the reason that it is calculated in pips. But a nice gimmick that maybe only needs a frame.
SnorreDK could you do a 1M Backtest on this one?
///Spread set to 0.9 points
defparam preloadbars = 10000
possize = 5
pointsp = 25 //points where profit is to be locked in //20 SP500
pointsb = 45 //points where stop is to be taken //36 SP500
fast = average[11,4](close) //11
medium = average[14,4](close) //13
TIMEFRAME (10 MINUTES, updateonclose)
A = 26
B = 8
S = 1.3
A1 = Average[A,B](low)
A2 = Average[A*s,B](low)
c3 = a1 > a2
TIMEFRAME (default, UPDATEONCLOSE)
//If countofposition = 0 then
//If fast > medium then
//BUY possize CONTRACT AT open + averagetruerange[3](close)*2 stop
//EndIf
//EndIf
If countofposition = 0 then
If fast > medium and c3 then
BUY possize CONTRACT AT open + 5*pipsize stop
EndIf
EndIf
If longonmarket and close >= positionprice + pointsp then
If close < close[1] then
SELL AT MARKET
EndIf
ElsIf longonmarket and close <= positionprice - pointsb then
SELLSHORT possize*2 CONTRACT AT MARKET
EndIf
If shortonmarket and close <= positionprice - pointsp then
If close > close[1] then
EXITSHORT AT MARKET
EndIf
ElsIf shortonmarket and close >= positionprice + pointsb then
BUY possize*2 CONTRACT AT MARKET
EndIf
SET TARGET pPROFIT 25 //50
SET STOP %LOSS 1.2
Yes.
Not that good outside the optimized period.
You then have to insert the conditions of the time frame M10 into the order instructions below…. But like I said, it’s pips … may not have worked that long ago. Then you would have to convert it to% profit.
what do you mean phoentzs ? its an else if command? so i do not need to insert it else where?
converted TP into % if SnorreDK could test to see if there is any diff in the performance this way
///Spread set to 0.9 points
defparam preloadbars = 10000
possize = 5
pointsp = 25 //points where profit is to be locked in //20 SP500
pointsb = 45 //points where stop is to be taken //36 SP500
fast = average[11,4](close) //11
medium = average[14,4](close) //13
TIMEFRAME (10 MINUTES, updateonclose)
A = 26
B = 8
S = 1.3
A1 = Average[A,B](low)
A2 = Average[A*s,B](low)
c3 = a1 > a2
TIMEFRAME (default, UPDATEONCLOSE)
//If countofposition = 0 then
//If fast > medium then
//BUY possize CONTRACT AT open + averagetruerange[3](close)*2 stop
//EndIf
//EndIf
If countofposition = 0 then
If fast > medium and c3 then
BUY possize CONTRACT AT open + 5*pipsize stop
EndIf
EndIf
If longonmarket and close >= positionprice + pointsp then
If close < close[1] then
SELL AT MARKET
EndIf
ElsIf longonmarket and close <= positionprice - pointsb then
SELLSHORT possize*2 CONTRACT AT MARKET
EndIf
If shortonmarket and close <= positionprice - pointsp then
If close > close[1] then
EXITSHORT AT MARKET
EndIf
ElsIf shortonmarket and close >= positionprice + pointsb then
BUY possize*2 CONTRACT AT MARKET
EndIf
SET TARGET %PROFIT 0.54
SET STOP %LOSS 1.2
I’m still testing myself. In any case, lines 4-6 and the corresponding instructions in the code must be given as a percentage in order to be able to test further back in a practicable manner. In my opinion, C3 must also be included in lines 33-44. So that people only buy and sell in the respective direction. I believe.
@Robertogozzi: Could you please surround the values in%? Also those in the “IF” loop?
Which code are you referring to?
What do you mean by SURROUND?
Which IF block?