Hi, this question is, I’m afraid, directed to Nicolas. Désolé.
I’m an end-of-day free platform user.
When trying to debug the code for the strategy presented by the forum member quo, I’ve found that for non-US/UK stocks, functions like BarIndex, High or Low give values corresponding to the bar previous to the bar currently active in the flow of the code.
This delay of one bar causes logical errors in the strategy or in the best of cases produces buys or sells one bar later than expected, which is inadmissible, especially on weekly or monthly time frames.
To prove the case and just to be on the safe side, being the tool graph a little tricky when there is any kind of error in the code, I’ve used the simplest of trading systems to graph barindex and high of an US stock (MU) and a french one (ORA):
1
2
3
4
5
6
7
8
// _ts_Dummy
ifnotonmarketand1<0then// do nothing
buy1sharesatmarket
endif
graphhighcoloured(0,255,0)
graphbarIndexcoloured(255,0,0)
// end of _ts_Dummy
Are you aware of this issue or am I just nuts?
Merci et bon week-end. Pas de hâte (I’m not nuts. Yet)
Like you may already know, PRT only read and launch code script once per bar, at its Close. Trades are then launched at the next Open.
I see you are end-of-day user, it may also have effect on the code, but I don’t think so though.
About the barindex 0 or 1, did you try to “preload” some bars? Why do you think starting the count of Barindex between 0 or 1 from the very first bar of history may cause difference in your TS ❓
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue