Discrepancy from function value and its CALL value
01/11/2019 at 5:27 AM #88359
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?
Finning01/11/2019 at 8:48 AM #8836501/11/2019 at 9:06 AM #88368
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.12345HH = highest(high)dd = (hh-close)/100return 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.01/11/2019 at 12:01 PM #8838401/11/2019 at 12:30 PM #8838601/11/2019 at 1:35 PM #8839301/11/2019 at 1:38 PM #88396
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.
Finning.01/11/2019 at 2:19 PM #88401
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.01/11/2019 at 2:36 PM #8840401/12/2019 at 12:23 AM #88415
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??
Finning.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263DEFPARAM CumulateOrders = false // Cumulating positions deactivateda = 10000+strategyprofitMarginRate = 0.005 // This CFD has a 0.5% margin - %OptimalF = .01 // This is the optimal F number - %CurrentMarket = closeCost = MarginRate * CurrentMarketOptFCapital = a * OptimalFCoverageRatio = OptFCapital / Costif CoverageRatio > 1.6 thenCoverageRatio=CoverageRatio-1endifPositionSize = ROUND (CoverageRatio)once trade = 0if not onmarket thentrade = 0endif// IndicatorsHH = highest(high)dd = (hh-close)/100RV = ddavRV = triangularaverage(RV)wavRV = endpointaverage(RV)// Conditions to enter short positionsb1 = RV > 0.5b2 = RV > RVb3 = RV > avRV and RV > wavRVb4 = year > 2013b5 = avRV > avRVIF b1 and b2 and b3 and b4 and b5 THENtrade = 2SELLSHORT PositionSize CONTRACT AT MARKETENDIF// Conditions to exit trade 1 positions//bx1 = RV crosses under 0.6bx2 = wavRV < wavRVIF bx2 THENtrade = 0EXITSHORT AT MARKETENDIFgraph tradegraph avRVgraph wavRVgraph RV01/12/2019 at 12:27 AM #8841601/12/2019 at 11:18 AM #88427
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?01/12/2019 at 2:13 PM #88432
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?01/12/2019 at 3:31 PM #88434
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.01/12/2019 at 3:44 PM #88436