Hello,
I have a question. During developing some of my strategies I did by an accident set up once Profit to zero (SET TARGET PROFIT 0). I have realized that this has immediately boosted all my strategies profits during testing, but obviously this does not work in real trading (at least with IG). I have spent many hours studying this behavior and try to replicate the internal function “set target profit 0”, but without any success. I think it behaves to some extend as following:
- If you are at some point profitable and then
- your profit becomes less than 0 and then
- you are about to become again profitable (so you going to reach Limit 0)
- Exit with being even
It seems simple but I really was not able to get the same results as with the internal function. I have prepared a simple example (see below), you can try it on USD/JPY on daily timeframe. Then just switch on and off the last line “SET TARGET PROFIT 0”. You will see the incredible difference. Do you anyone have some idea why this setting does not work in real trading or is there a way to replicate it? I have contacted IG but they told me to write here. Thanks a lot for everyone trying to answer this, cheers!
Try on USD/JPY on daily timeframe, if you disable the last line (profit) you will see the big difference
Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = Average[20](close)
c1 = (indicator1 CROSSES OVER close)
IF c1 THEN
BUY 10 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
c2 = (indicator1 CROSSES UNDER close)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
c3 = (indicator1 CROSSES UNDER close)
IF c3 THEN
SELLSHORT 10 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
c4 = (indicator1 CROSSES OVER close)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 2.75
SET TARGET PROFIT 0
I also had there some strange test results. I thought it was a bug of PRT.
ProBacktest doesn’t simulate what the broker server is interpreting with your “set target profit 0”. Obviously, in backtests it will behave differently, it is the same thing as putting stoploss order too close to the open price, or in the spread, it’s always your broker that will have the final word. It is not a bug, as Despair thought.