Topics
Replies
noolohp
11 Jan 2023, 08:15
RE:
PanagiotisChar said:
Hi noolohp,
Try deleting your backtesting cache in C:\Users\user\AppData\Roaming\broker cTrader\BacktestingCache
Need help? Join us on Telegram
Need premium support? Trade with us
Hi PanagiotisChar,
Can you be more specific on the approach to delete the backtesting cache, please?
best regards,
NL
@noolohp
noolohp
26 Aug 2022, 11:57
RE:
PanagiotisCharalampous said:
Hi noolohp,
it will then direct that Bars.Opentime[i] must be 1 bar ahead of Bars.Last(1).OpenTime and not as the result shows.
No that is not how it works. Bars.Last(1).OpenTime is not equal to Bars.OpenTime[i]. Last() methods counts backwards therefore Bars.Last(1).OpenTime = Bars.OpenTime[Bars.Count - 2]
Best Regards,
Panagiotis
Hi PanagiotisCharalampous,
Thank you for the information.I will work on it.
Best regards,
NL
@noolohp
noolohp
25 Aug 2022, 09:43
RE:
PanagiotisCharalampous said:
Hi noolohp,
he results always show that Bars.Last(1).OpenTime is 1 bar ahead of Bars.OpenTime[i]
Correct. The proble here is that sometimes i is > 1, therefore it points to an older date. There is clearly a logical error in your code. You need to debug it and understand what is wrong.
Moreover, with regards to the mentioned code is there any possible alteration, in your opinion, to align the two value ?
No, because I have no idea what you are trying to do. I can only explain what you are doing which is probably not aligned with your intentions.
Best Regards,
Panagiotis
Hi PanagiotisCharalampous,
However, I am still confused as if i is sometimes more than 1 it will then direct that Bars.Opentime[i] must be 1 bar ahead of Bars.Last(1).OpenTime and not as the result shows. For instance, a backtesting process with a total of 100 bars, Bars.OpenTime[i] would start with Bars.OpenTime[1] and then surplus each time to Bars.OpenTime[100]. Therefore, if i > 1 , wouldn't it a newer date instead of older date ?
Best regards,
NL
@noolohp
noolohp
24 Aug 2022, 17:18
( Updated at: 24 Aug 2022, 17:19 )
RE:
PanagiotisCharalampous said:
Hi noolohp,
as per my understanding Bars.OpenTime[] starts from [0] and surplus each time new bar is opened so with i++ the value of Bars.OpenTimes[i] should be the same as Bars.Last(1).OpenTime
But you run the loop from the beginning for each bar, therefore the condition (see below) that prints the curreBarOpenTime might become true before the last bar is reached.
if (isCurrentBarRed && isPreviousBarRed && !isRedDriven)
Best Regards,
Panagiotis
Hi PanagiotisCharalampous,
Can you please amplify the above statement ? I apologize but I am abit confused as the results always show that Bars.Last(1).OpenTime is 1 bar ahead of Bars.OpenTime[i], thus, if the above statement is true, shouldn't the result be the otherway around ? Moreover, with regards to the mentioned code is there any possible alteration, in your opinion, to align the two value ?
Best regards,
NL
@noolohp
noolohp
23 Aug 2022, 18:09
RE:
PanagiotisCharalampous said:
Hi noolohp,
I am not sure why you expect the two values to match. Here you always pring the last value
Print("method " + Bars.Last(1).OpenTime);
and here you print a value based on the i counter
Print(curreBarOpenTime);
Best Regards,
Panagiotis
Hi PanagiotisCharalampous,
the curreBarOpenTime represents Bars.OpenTimes[i] in the while loop in OnBar() which I am trying to gather data based on the logic within the loop from the first data provided to the last data, thus, the Bars.OpenTimes[i] will always represent the last value of the graph (the same as Bars.Last(1).OpenTime) as per my understanding Bars.OpenTime[] starts from [0] and surplus each time new bar is opened so with i++ the value of Bars.OpenTimes[i] should be the same as Bars.Last(1).OpenTime. Moreover, the majority of the results show that the data gathered are from the same date and time but there are a few of them which show disprecancy in data gathered. For instance from the attachment, 19/07/2565 2:03:00 (Bars.OpenTimes[i]) and method 19/07/2565 2:03:00 (Bars.Last(1).OpenTime) are the same as well as 19/07/2565 2:05:00 (Bars.OpenTimes[i]) and method 19/07/2565 2:05:00 (Bars.Last(1).OpenTime)
Best Regards,
NL
@noolohp
noolohp
18 Aug 2022, 11:39
( Updated at: 21 Dec 2023, 09:22 )
RE:
PanagiotisCharalampous said:
Hi noolohp,
Your problem is here
You assume that the Bars.Last(1).Close will be the same as the entry price but it is not. You should calculate your SL based on the position's entry price.
Best Regards,
Panagiotis
Thank you PanagiotisCharalampous, I will work on that.
@noolohp
noolohp
17 Aug 2022, 20:08
( Updated at: 21 Dec 2023, 09:22 )
RE:
PanagiotisCharalampous said:
Hi noolohp,
I cannot buid this code in order to run it and understand what you are looking at. Can you please provise some code that we can run? Also can you share some screenshots showing the problem you are mentioning?
Best Regards,
Panagiotis
Hi PanagiotisCharalampous,
Thanks for the reply. Here are some usable code which replicate the mentioned problem and some screenshots.
@noolohp
noolohp
11 Jan 2023, 12:14 ( Updated at: 21 Dec 2023, 09:23 )
RE:
PanagiotisChar said:
I've already tried doing so but there is no backtestingcache as seen in the attachment. I also did try deleting the content shown in the folder and the problem still exists.
best regards,
NL
@noolohp