Hello
I would like to backtest a system with has two different entrys. Every Entry has his own exit Strategies for take profit and SL.
Is it possible to connect
Entry 1 with Exit parameter 1
Entry 2 with Exit parameter 2
Thank you!
There you go:
DEFPARAM CumulateOrders = false
//
IF Not OnMarket THEN
ID = 0
ENDIF
//
// strategy 1
//
MyLongCondition1 = close CROSSES OVER average[20,0](close)
MyShortCondition1 = close CROSSES UNDER average[20,0](close)
IF Not OnMarket AND MyLongCondition1 THEN
BUY 1 CONTRACT AT MARKET
SET STOP pLOSS 100
SET TARGET pPROFIT 200
ID = 1
ENDIF
IF Not OnMarket AND MyShortCondition1 THEN
SELLSHORT 1 CONTRACT AT MARKET
SET STOP pLOSS 100
SET TARGET pPROFIT 200
ID = 1
ENDIF
//
// strategy 2
//
MyLongCondition2 = Rsi[14](close) CROSSES OVER 50
MyShortCondition2 = Rsi[14](close) CROSSES UNDER 50
IF Not OnMarket AND MyLongCondition2 THEN
BUY 1 CONTRACT AT MARKET
SET STOP pLOSS 120
SET TARGET pPROFIT 240
ID = 2
ENDIF
IF Not OnMarket AND MyShortCondition2 THEN
SELLSHORT 1 CONTRACT AT MARKET
SET STOP pLOSS 120
SET TARGET pPROFIT 240
ID = 2
ENDIF
graph ID
Thank you
How I have to change the code if i want to trade strategy 1 and 2 simultaneously.
How can i splitt my strategy capital?
I have 100.000 for each strategy.
Thank you sir!
For the system it’s ONE strategy, so you can’t split the Capital among the two separate logical entries.
If you want to allow both entries go the same direction, then you need to allow accumulating orders, then do not check that you are onmarket when openuing a new piosition.
If, instead, you only want to allow them to go the opposite directions, then you have to bear in mind that the same strategy CANNOT open two opposite trades. So in this case you will need to resort to Stop & Reverse, thus closing the LONG trade when you want to go SHORT and viceversa.