Multi timeframe – MTF indicators for ProRealTime
Forums › ProRealTime English forum › ProBuilder support › Multi timeframe – MTF indicators for ProRealTime
- This topic has 126 replies, 42 voices, and was last updated 1 month ago by Nicolas.
Tagged: mtf, mtf indicators
-
-
03/13/2024 at 6:54 PM #229709
Hi
perhaps not enough history/units are loaded on your 5 min charts ?
No, selecting different amount of units make no difference.
Also tried different timezones (as there was a wintertime/summertime switch this weekend in US). Same problem.
Can someone else try this example code?
03/13/2024 at 7:00 PM #229710hi.. Brushed up against this problem on another post, way back, problem not solved, and the solution was a work around, using hours.
However, daily and 24hours might not be the same, depending on the start reference. Not looked into that and verified if it is or isn’t.
#jerome888 brings up a good point with the historical units.
5min x 12 per hr x 24hr = 1440 mins 1440mins/ 5min = 288 units per day 2days = 576 units
The reason for 2days is worst case scenario, from before the last bar on a day, back to the days open, then back another day to previous days open.
The default loaded historical units is about 500 at 25units setting, so not enough.
Further…
By comparing values from the test code below on 5min chart and daily candles on daily chart , you can see that:-
- The TF..(Daily) open[1] doesn’t give a value until a new day starts and the value it gives is the open at barindex = 0 or bar zero of the chart TF and not required value. This appears to happen even if you increase the units. Its not until the following day it reads right. This means you need enough bars to include the days open and days close before correct value resolved.
- Replacing the TF..(Daily) open[1] with Dopen[1], gives the correct value at bar zero, even with default historical bars loaded and the bar of the previous day isn’t available in the chart.
- Removing the daily timeframe and its code and just using Dopen[1] in the chart/default timeframes give required results.
Since open[1] version doesn’t render a value, straight away, it could be undefined. An undefined variable may cause calculation error. That what i’m thinking at the moment.
Further to your problem your psesudo code works without problem on its own, and previous experience leads to the conclusion that there is a conflict between other parts of your code which using TF Daily brings out and hours may not.
I’m unable to re-create error to investigate further, if you can post the full code, and screenshot of error message it could help toward solving problem if work around unsuitable. That’s not to say it can be solved!
Regards druby
12345678TIMEFRAME(daily)b = open[1]c = Dopen(1)TIMEFRAME(default)d = Dopen(1)return b coloured("red"), c coloured("green")style(dottedline,1),c coloured("yellow")style(dottedline,4)1 user thanked author for this post.
03/13/2024 at 7:33 PM #229713I stripped the code even more. It doesn’t matter what you put in the ‘TIMEFRAME(daily)’ part. As soon as you put this line of code there, it crashes.
Even with no code inside, it crashes. See screenshot.The thing is, it works for a second. I can see the calculated line at the chart. But then it disappears and I get the error popup
03/13/2024 at 8:10 PM #229717The thing is, it works for a second. I can see the calculated line at the chart. But then it disappears and I get the error popup
Found out this happens with a quote update. So problem only occurs when the market is open
03/14/2024 at 10:02 AM #22975103/14/2024 at 2:49 PM #229766I have no issue running your code. Could you please give me instrument and timeframe used, and PRT version? Thank you.
Today it’s working again…
I will keep an eye on it.
Thanks anyway
03/15/2024 at 10:28 AM #229827 -
AuthorPosts