IfBarIndex>0then// 05-08-2021,PS. So all the code is not called when PreLoadBars is running (yep).
// My Code.
endif// Very end of the code.
Below shows the very beginning of a chart.
In the 05-08-2021 comment you can see that at that day I surrounded all my code with the If BarIndex > 0. This was also the day that I filed a complaint related to PreLoadBars with a response from 2nd line support in the realm of “this is how it works – deal with it” (the tone was nicer, but the solution was not there 🙂 ).
The past days I am suffering from an issue which is related to the start of the strategy (I changed something so I could notice it), and now I am stumped because what I see :
The BarIndex variable (I think people in the PRT environment tend to call it a constant) is not zero any more at the start of the chart. And so my code is running into trouble, and it could finally explain why I usually lose a first trade after starting the backtest (happens also in Live).
The orange line shows best what I mean – the strategy thinks that I entered the market which really happened only at ~ 13:20 for the first time.
This is a moment that I really hate it that PRT does not provide anything like a changelog / releasenotes and I think it is inordinate that something crucial like this has been changed. That is, if I did not go bananas by now. Roberto @robertoguzzi, I recall that I saw you using the If barIndex > 0 for good habit, but maybe I dreamt it. Maybe I dream too much anyway.
I recall that my complaint this summer was about all code just executing in the PreLoadBars phase, except for the orders not really being taken. Thus, all of the code executes, but the Buy xx at Market etc. is ignored until the bars to be preloaded are all there. And now, with the BarIndex not being at zero when the chart starts, this happens all the same – wrongly – again; my code again all executes, but the orders are ignored. This time, however, I don’t know the solution.
I suppose (and hope) this is a bug. But for now people should be aware that this bug is there, which is a mighty dangerous one. I am putting this through to support in a minute …
Meanwhile please let me know if I overlook something or judge wrongly. Thanks !
don’t worry about that (Moto GUZZI is the brand of an italian motorcycle manufacturer) 🙂
I often use that to avoid using (sometimes) ONCE, with the definition of Heikin-Ashi candlesticks and maybe in other cases when I want to be sure that enough bars have been built before I calculate something.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.