Autotrading keeps failing: preloadbars not working?
Forums › ProRealTime English forum › ProOrder support › Autotrading keeps failing: preloadbars not working?
- This topic has 14 replies, 5 voices, and was last updated 4 months ago by GraHal.
-
-
07/10/2023 at 9:28 AM #217487
Hi,
I get this error:
The trading system was stopped because the historical data loaded was insufficient to calculate at least one indicator during the evaluation of the last candlestick. You can avoid this in the future by changing the number of preloaded bars with the instruction DEFPARAM (ex: DEFPARAM Preloadbars = 10000).
However, I have added preload bars… doesn’t seem to change anything, even if I go to 100,000 bars preloaded (which it cannot need). Any obvious pointers greatly received.
Thanks
Rufus
07/10/2023 at 9:41 AM #217488Have a read of this Topic
https://www.prorealcode.com/topic/long-time-to-run-system-code-causes-rejection/#post-216815
1 user thanked author for this post.
07/10/2023 at 9:56 AM #21748907/10/2023 at 10:50 AM #217491Does your code get Rejected at the end of the 1st bar when the code first executes? Put another way … your code does not successfully execute and is always Rejected?
If Yes to above then submit a Technical Report via Help > Help Center > I’m having a Technical Problem.
1 user thanked author for this post.
07/10/2023 at 11:50 AM #21749207/11/2023 at 8:25 AM #21752807/11/2023 at 8:52 AM #217529It has to be a Technical Report submitted via via Help > Help Center > I’m having a Technical Problem.
See the top / main toolbar on the PRT Platform? Far right Help (far left is File) … then follow above.
I had an acknowledgement and Case Ref on 28 Jun, but no resolution from PRT yet.
This is why it is good if you / more of us submit a Technical Report for the same symptoms as then PRT may finally realise there is a probem (not just me!) that needs sorting.
1 user thanked author for this post.
07/11/2023 at 9:04 AM #21753107/11/2023 at 6:27 PM #2175411234HelloI have the same error in several strategies. These have been working without problem for months both live and in demo, but for a few days it has not been possible to work.I have sent a request for technical help to the PRT team but for now no response.If I find out anything about the issue I will share it in the forum.07/11/2023 at 8:18 PM #21754407/25/2024 at 11:09 AM #235759Hi all,
I’m have a similar problem. I reported it to technical support,but just wondering whether anyone has any updates?
I have a system running on 3 minute TF and 30 minute TF. I have a preloadbars command which should be sufficient as far as I can tell. The error I get is below, and I always get this when first attempting to start the strategy.
The trading system was stopped because the historical data loaded was insufficient to calculate at least one indicator during the evaluation of the last candlestick. You can avoid this in the future by changing the number of preloaded bars with the instruction DEFPARAM (ex: DEFPARAM Preloadbars = 10000).
07/25/2024 at 2:06 PM #235784UPDATE – after some further debugging, I found that this statement appears to be the cause of the error.
123OffsetOfLastTrade = BarIndex - TRADEINDEX (1)SLPoints = ATRsStopLoss *currentATR [OffsetOfLastTrade ]SET STOP PLOSS SLPointsIt works ok if I remove the offset. So, the following code does work…
12SLPoints = ATRsStopLoss * currentATRSET STOP PLOSS SLPointsPerhaps when the system first runs, and no trade has happened, the TRADEINDEX(1) is NULL and so can’t be used in a calculation, which kind of makes sense.
1 user thanked author for this post.
07/25/2024 at 4:32 PM #235791UPDATE II
I got to the bottom of the actual problem (in my case). The code below has a bug which results in the error that says more bars are needed. The reason is that TRADEINDEX(1) returns zero when there are no trades. My offsetOfLastTrade therefore becomes the whole barindex value. When it gets used in the second line of code, currentATR[OffsetOfLastTrade] it throws an error.
I’m guessing there are similar situations in people’s strategies that also cause this error to be thrown.
123OffsetOfLastTrade = BarIndex - TRADEINDEX (1)SLPoints = ATRsStopLoss *currentATR [OffsetOfLastTrade ]SET STOP PLOSS SLPoints07/25/2024 at 5:08 PM #235793Tradeindex, or Tradeindex(1), retains 0 only BEFORE the very first trade, later on it will always retain the BarIndex value of the last operation, so when Not OnMarket it will retain the BarIndex value when the last trade was closed.
07/25/2024 at 6:42 PM #235795 -
AuthorPosts
Find exclusive trading pro-tools on