Yesterday I ran a backtest with no complications whatsoever, today though I ran the same test and the backtest showed the “insufficent funds” icon on the equity curve.
As you can clearly see on the picture below the funds are very much sufficent but the test stopped anyway. What has happened here?
Funds are not sufficient to open more contracts, as it seems you are already on market with large amount by cumulating orders?
Hello Nicolas, I don´t think that´s the problem since I´ve set the maximum position size to a maximum of 4 contracts. And as you can see on the picture the system have been able to take 4 contracts previously without problem.
Please give more information:
- instrument
- timeframe
- code
Instrument: Sverige 30 Cash (20SK)
Timeframe: 15 000 units 5M
Code:
//Regler
MaximumContracts = 4
TooManyContracts = abs(countofposition) >= MaximumContracts
//Bollinger Indikator 1
BandsPeriod=14
BandsDeviation=1.25
Chars= 100
period = 200
dev = 2
data = customclose
MA = average[period](data)
BolUp = MA+STD[period]*dev
BolDn = MA-STD[period]*dev
if barindex>max(Chars,BandsPeriod) then
Dev = std[BandsPeriod]*BandsDeviation
Dev1 = square(Dev / Pointsize)
temp=sqrt(average[chars](dev1))*pointsize
if temp<>0 then
temp=dev/temp
endif
if(temp>0) then
iexp=Exp(-2*temp)
returnNum= (1-iexp)/(1+iexp)
osc= (returnNum)
else
iexp=Exp(2*temp)
returnNum=(iexp-1)/(1+iexp)
osc= (returnNum)
endif
endif
//Variables
Datum = 20200102
NewYears = abs(Today)
tma = TEMA[21]
sma = Average[200]
clow = low
distansb = 1.0001
tpl = 22
tps = 26
st = 10
//Villkor
if not (NewYears = Datum) then
//Standard Long
if osc > 0.985 and close>tma and close<BolDn and not TooManyContracts then
buy 1 contracts at market
set target pprofit tpl
endif
//Standard Short
if osc > 0.985 and close<tma and close>BolUp and not TooManyContracts then
sellshort 1 contracts at market
set target pprofit tps
endif
//Exit Long
if close crosses under sma then
sell at market
else
if close crosses under BolDn then
sell at market
endif
endif
//Exit Short
if close crosses over sma then
exitshort at market
else
if close crosses over BolDn then
exitshort at market
else
if (clow/sma) < distansb and close > open then
exitshort at market
endif
endif
endif
endif
//Money Management
set stop ploss st
Yes I have the same issue, and I can’t explain it now.. Funds are sufficient and equity is good, it should not behaves this way.. I’m asking PRT about that, please do it on your side by sending a tech report with the dedicated tool in the help section menu of the platform, and add the topic URL please.
That issue is currently investigated, I’ll give news once I had some.
Thank you very much Nicolas. Now however it seems like the problem has resolved itself since the backtesting is working properly, but perhaps PRT would like to investigate anyway.
it seems like the problem has resolved itself
Yes I tried well over 30 mins ago over 100K bars and my backtest wasn’t stopped.
Maybe PRT fixed it after Nicolas prompted them?