Let’s try this code:
// Definición de los parámetros del código
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada
DEFPARAM FlatAfter =172900
once ordersize=1
HoraEntradaLimite = 090600
HoraInicio = 090500
capital=10000+strategyprofit
n=capital/5000
if Ordersize>50 then
Ordersize=10
endif
if Time >= HoraInicio and time <= HoraEntradaLimite then
// Condiciones de entrada de posiciones cortas
c1 = open < close-2
if not onmarket then
IF c1 THEN
IF PositionPerf(1) < 0 THEN
OrderSize = OrderSize-1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
ENDIF
endif
buy ordersize+n shares AT close+2 stop
endif
c2= open > close-1
IF c2 THEN
iF PositionPerf(1) < 0 THEN
OrderSize = OrderSize-1
if ordersize<1 then
ordersize=1
ENDIF
ELSIF PositionPerf(1) > 0 THEN
OrderSize =OrderSize+2
if ordersize<1 then
ordersize=1
endif
ENDIF
sellshort ordersize+n shares AT close-2 stop
endif
endif
endif
SET STOP ploss 10
set target profit 5
CNParticipant
Senior
Raul:
Alot more winning trades then loosing, big difference since before. Thanks!
CNParticipant
Senior
@
volpiemanuele
How come the latest strat you posted gives a worse G/L-ratio then the earlier one you posted? (Gives better totalt result aswell, more gains)
Whats the diference?
Hi,
first of all i have optimize the maximun lot..I have insert 18 instead of 38. Thanks
CNParticipant
Senior
@volpiemanuele
Alright,does that optimize the strategy? how and why?
BCParticipant
Master
Live and backtest result of Raul 1st version in libary were different with v10.2
Live short on yesterday 8:05 at 11555.2, and close at 11560.2, result was lose.
But backtest result was win, why cause this situtation? V10.2 problem? really confuse….
hi,
I think that in real we must consider slippage that in backtest not there. I hope not to bring the strategy at the loss in the long run. In this moment there aren’t other parameters to optimize. If I have other idea i send other post. Thanks
AlcoParticipant
Senior
Hi volpiemanuele,
Could you tell me how your code works? Is it based on margin? Normally when you have a losing trade, the ordersize decrease. But after building from ordersize 1 to 18, it stays after 4 months at 18.
EricParticipant
Master
when backtesting you have no problem with execution of the trade you get filled instant
but maybe in real trading you get a small delay from signal to execution specially around open and news when volatility is high, price can move much in a second
and sadly when trading with real money it can be even worse
@ALCO
Yes, now i set 38 max lots. The strategy from me it’s efficient because the system increment the lots only if there are funds in the account created by the strategy itself. Then the maximum number of lots to choose also depends on the amount of risk that one wants in addition to the optimization of the same strategy.
@CN
Yes, I changed the take by 5 and the stop to 10, evidently win more times, but less money. Now, to see if
@jonjon can prove it is better long term or worse.
Hi volpiemanuele,
Good job, I’ve modified the code a little, to see what you think:
// Definición de los parámetros del código
DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada
DEFPARAM FlatAfter = 173000
once ordersize=1
HoraEntradaLimite = 090600
HoraInicio = 090500
Margin = 60
Lottfree = 0
orderSize = max(1,5+ROUND((strategyprofit-lottfree)/Margin))
ordersize=min(40,ordersize)
n=1
if n>=10 then
n=10
endif
if n<=1 then
n=1
endif
if Time >= HoraInicio and time <= HoraEntradaLimite then
if not onmarket then
c1 = open < close-2*pointsize
c2= open > close-1*pointsize
IF PositionPerf(1) < 0 THEN
n = n-1
ELSIF PositionPerf(1)> 0 THEN
n =n+2
endif
ordersize=max(ordersize,1)
IF c1 THEN
buy ordersize+n contract AT close+2 stop
endif
IF c2 THEN
sellshort ordersize+n contract AT close-1 stop
endif
endif
endif
SET STOP ptrailing 5
Also works if you change:
IF PositionPerf(1) < 0 THEN
n = n-1
for:
IF PositionPerf(1) < 0 THEN
n = n/2
@Raul
Very Good. Similar drowdown, equal % profit but much gain in order to much loots trade. I prefer to start with my version because I want to start with 1 lot. Your version start with 6 lots.
Do you trade in real account with this system ? I start yesterday and I loss 0,98 euro. Starting from monday I trade with my version posted with max 38 lots.
Tanks a lot
Volpiemanuele, I have a question about your risk management. As of January 22, 2016, with a profit of about € 2250, it always puts 38 contracts. From what I understand, he adds a contract by earning 60 euros (2250/38 = 60). And if it drops 60 euros, a contract remains. That is, from 2250 euros of profits, will always use 38 contracts. Do not you think that if with 2,250 euros of benefit you can risk using 38 contracts, if you reach 15,000 euros of profits could you use more than 38 contracts?