Topics
Forum Topics not found
Replies
Daedalusx086
15 Nov 2015, 22:42
Looks like that is being caused by the fact you're only updating the values for Current_Open_Price and Current_Close_Price at the start of each new bar.
That means that when you're getting the values for Current_Close_Price when only 1 tick has defined the current bar, which means the close price (the last tick) the system has for that bar also happens to be the starting (opening value) for that bar. Backtesting treats the tick flow as if it's in real-time for the bot, so won't let it see the "future" (namely the ticks yet to pass) from the bot's time reference.
You would need to adjust your code so it is updating the Current_Close_Price dynamically every few ticks if the Current_Close_Price is vital in your algo.
Cheers.
@Daedalusx086
Daedalusx086
03 Nov 2015, 09:59
MarketSeries.TimeFrame.ToString()
Should be what you're after.
@Daedalusx086
Daedalusx086
05 Dec 2015, 02:02 ( Updated at: 21 Dec 2023, 09:20 )
RE: Your materials need to be better
jhtrader said:
Hey JHTrader,
The NaN you are getting arises from the disparity between the rates of growth in the indexes on different timeframes. Your results are there, just not displaying in terms of the chart time frame - see below pic:
As the indexes grow at different rates (15 min at 4 times that of the 1 hour time frame), you need to convert the index of the chart time frame you want to get the result for to terms of the referenced time frame.
The following code shows the changes in the indicator that are required to get the referenced time frame to show in terms of the chart time frame (plus I updated the NaN check, just couldn't help myself):
Cheers.
@Daedalusx086