Hi all,
am having a problem with the CALL function – and the value that it’s giving me for use with orders.
The probacktest code that I had made didn’t seem to be working as intended – don’t they all – but upon closer inspection, I found that there was a discrepancy between my custom function value “Recent Volatility”(15) – and what the probacktest “GRAPH” of the called value of this function (CALLED and GRAPHed as”RV”) was displaying for the function value.
I am calling a function that I made – “Recent Volatility”(15). I am definitely calling the right function – there is no error of function name/function called – or period of the function (15) used between what is displayed and the CALL of the function in probacktest.
There is also the same problem for the triangluar average (6) of the “Recent Volatility”(15) function – but I would assume that this is from the problem above?
What would be causing the probacktest GRAPH value of the “Recent Volatility”(15) function to be different to the original displayed calculated function value?
Thanks,
Finning
How many bars do you preload in your ProOrder program? What is the code of the “Recent Volatility” indicator?
Hi Nicolas,
I am not using “Defparam preloadbars” in the probacktest script .
The data that it was tested on was a 1000 units of daily bars – with the error shown being about half way into this dataset.
HH = highest[15](high)
dd = (hh-close)/100
return dd
Code is attached.
The only thing that I can think of is that in probacktest it is switching over and using active position data for the “close” (so including spreads?) instead of the listed “price” data that is seen on the price graph?
Thanks for your help.
Are you using customized hours on your main chart? I think that the discrepancy comes from different bars quantity for the calculation between ProBuilder and ProBacktest. Please check.
Hi Nicolas-just out at the moment. I do know that the main setting for time under settings is on GMT +10hrs brisbane time if that makes a difference?
Cheers
This is what the default market hours settings look like, make sure they are set the same as in the attached picture (for ASX of course).
HI Nicolas – just got back – read your suggestion. Regarding customized hours – right click on the chart – “custom trading hours” – and I’ve attached a picture of what mine is currently set at. I’ll change my settings to what you have suggested and I’ll let you know.
Thanks,
Finning.
Hi Nicolas,
I have tried many different types of settings changes for time settings – including the local time on the computer – and it hasn’t seemed to have made a difference?
I have used/modified both the “Indices” and “Indices – Australia” settings to try and align with what you have suggested and have not had any luck.
You could try to get rid of CALL and embed the indicator in your strategy to spot any difference in its behaviour.
Hi Roberto/Nicolas,
I have tried Roberto’s suggestion and got rid of the the CALL function, and have put the few lines of code directly into the probacktest script.
Unfortunately I still have the same problem. Tested on 1000 units of daily bars.
I have attached the probacktest code used without the call function to help complete the picture.
The failures seem to be non-uniform/sporadic? With periods of the same values in between?
Not unless I didn’t complete the time change requirement as per above properly… did very much try??
Thanks,
Finning.
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
a = 10000+strategyprofit
MarginRate = 0.005 // This CFD has a 0.5% margin - %
OptimalF = .01 // This is the optimal F number - %
CurrentMarket = close
Cost = MarginRate * CurrentMarket
OptFCapital = a * OptimalF
CoverageRatio = OptFCapital / Cost
if CoverageRatio > 1.6 then
CoverageRatio=CoverageRatio-1
endif
PositionSize = ROUND (CoverageRatio)
once trade = 0
if not onmarket then
trade = 0
endif
// Indicators
HH = highest[15](high)
dd = (hh-close)/100
RV = dd
avRV = triangularaverage[6](RV)
wavRV = endpointaverage[12](RV)
// Conditions to enter short positions
b1 = RV > 0.5
b2 = RV > RV[1]
b3 = RV > avRV and RV > wavRV
b4 = year > 2013
b5 = avRV > avRV[1]
IF b1 and b2 and b3 and b4 and b5 THEN
trade = 2
SELLSHORT PositionSize CONTRACT AT MARKET
ENDIF
// Conditions to exit trade 1 positions
//bx1 = RV crosses under 0.6
bx2 = wavRV < wavRV[1]
IF bx2 THEN
trade = 0
EXITSHORT AT MARKET
ENDIF
graph trade
graph avRV
graph wavRV
graph RV
Market is IG Au Australia 200 Cash (A$25)
Either setting “Defparam preloadbars=0” or not setting it at all I found out that
- discrepancies start on Oct. 5th, 2009
- discrepancies end on Oct. 21st, 2014 (see attached pics)
sometimes they are relative only to one of the three values (RV, Triangular average and Endpoint average), sometimes to all of them, but can’t figure out why.
Maybe there’s been something in the data flow on those dates for that instrument?
Hi Roberto,
thank you for looking at this for me.
So just to clarify – you don’t think that this is a problem with default market hours settings? These settings don’t appear to be the problem then?
I never use “defparam preloadbars = x” on any of my codes – I know this can make things slower – but is this otherwise a problem?
I will try testing after Oct. 21st, 2014 to see if there are no problems after that. Though now not having access to 5 years of data is a substantial problem in itself…
I will also try the code on other indexes to see if there is a similar problem/narrow it down to just the ASX200 index being at fault?
“Maybe there’s been something in the data flow on those dates for that instrument?”
This dataflow problem – so essentially prorealtime is getting the data (initial “RV” indicator creation/display) but the probacktest script isn’t getting/isn’t processing price data properly sometimes… either I’m doing something else wrong/there is another problem – or probacktest (script) that can’t deal with simple price data – this is a bit of a problem right?
Have you seen such a data flow problem before?
I don’t think it’s time dependent, I’m using CET (Central European Time) which is UTC+1 (UTC+2 when DST applies) and no cutomized trading hours.
Data used by ProBuilder are (or should?) be the same as those used by ProBackTest, so I can’t figure out why there are such discrepancies.
You should try other instruments, but also the same one with different TF’s, weekly and 4-hour if possible.
If you don’t succeed in finding a solution I suggest that you contact PRT by type Ctrl+M from the platform.
I once experienced an error with some TF’s and mini FX contracts (not regular contracts). It was a bug and was corrected with a few weeks.
Hi Roberto,
Thank you for your help and perspective with this. I will try the other test scenarios and I’ll see what happens. Will contact PRT if problem remains on going.
Thanks,
Finning.