I'm still using v5.5 of MC. I'm seeing my indicators that have "Update on every tick" enabled, are being executed twice at the start of each new bar. This can be shown by printing the reserved word barstatus, which shows the following results. Has this been fixed in 6.0?
1
1
1
2 <-- end of a bar
0 <-- start of next bar
0 <-- repeated
1
1
1
Indicators repeated an extra time on each new bar
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
I have modified the code:
I am using MC Version 6.0 Beta 4 (Build 3445)
this is the print out from KSU0 at 1 min bar interval:
Code: Select all
if LastBarOnChart_s then print (currenttime_s, barstatus);
this is the print out from KSU0 at 1 min bar interval:
211350.00 1.00
211353.00 1.00
211400.00 1.00
211400.00 2.00
211400.00 0.00
211400.00 0.00
211401.00 1.00
211402.00 1.00
211402.00 1.00
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
here's another print out, with another modified code:
this print out is on KSU0 15 sec bar interval:
looks like barstatus=0 was printed twice, but no addition to the volume.
.
Code: Select all
if LastBarOnChart_s then print (currenttime_s, barstatus, c, ticks);
this print out is on KSU0 15 sec bar interval:
212325.00 1.00 225.80 145.00
212327.00 1.00 225.85 150.00
212328.00 1.00 225.80 151.00
212330.00 2.00 225.80 151.00 <-- barstatus=2, same volume count
212330.00 0.00 225.80 16.00
212330.00 0.00 225.80 16.00 <-- duplicate barstatus=0
212331.00 1.00 225.80 20.00
212332.00 1.00 225.75 21.00
212336.00 1.00 225.75 41.00
212337.00 1.00 225.75 170.00
212337.00 1.00 225.75 171.00
212338.00 1.00 225.80 176.00
212339.00 1.00 225.80 181.00
212339.00 1.00 225.80 186.00
212340.00 1.00 225.80 191.00
212342.00 1.00 225.80 193.00
212343.00 1.00 225.80 195.00
212344.00 1.00 225.80 196.00
212345.00 1.00 225.75 197.00
212346.00 2.00 225.75 197.00 <-- barstatus=2, same volume count
212346.00 0.00 225.80 5.00
212346.00 0.00 225.80 5.00 <-- duplicate barstatus=0
212347.00 1.00 225.75 47.00
212348.00 1.00 225.75 49.00
212348.00 1.00 225.75 50.00
212349.00 1.00 225.75 54.00
212351.00 1.00 225.75 55.00
212352.00 1.00 225.75 56.00
212352.00 1.00 225.75 57.00
212353.00 1.00 225.75 61.00
212356.00 1.00 225.75 62.00
212356.00 1.00 225.80 68.00
212357.00 1.00 225.80 74.00
212358.00 1.00 225.80 75.00
212359.00 1.00 225.75 76.00
212359.00 1.00 225.80 77.00
212400.00 1.00 225.80 78.00
212400.00 2.00 225.80 78.00 <-- barstatus=2, same volume count
212400.00 0.00 225.75 1.00
212400.00 0.00 225.75 1.00 <-- duplicate barstatus=0
212405.00 1.00 225.75 2.00
212405.00 1.00 225.75 3.00
212406.00 1.00 225.75 5.00
212407.00 1.00 225.75 232.00
212408.00 1.00 225.70 236.00
212409.00 1.00 225.70 238.00
212410.00 1.00 225.75 248.00
212410.00 1.00 225.70 249.00
212411.00 1.00 225.70 250.00
212414.00 1.00 225.70 251.00
212414.00 1.00 225.70 252.00
212415.00 1.00 225.70 254.00
212416.00 2.00 225.70 254.00 <-- barstatus=2, same volume count
212416.00 1.00 225.75 4.00 <--- note no barstatus=0
212416.00 1.00 225.75 4.00
212416.00 1.00 225.70 5.00
212417.00 1.00 225.70 6.00
looks like barstatus=0 was printed twice, but no addition to the volume.
.
Last edited by TJ on 12 Jul 2010, edited 1 time in total.
Yes, I noticed that too - occasionally there is no 0. I don't understand why it's not recognised these two bugs are major ones as they will have a significant impact on studies that rely on the barstatus value. I'm certain this has been flagged some time ago and I'm disappointed it's still not fixed.
The other thing you will notice is when the barstatus = 2 the tick is a repeat of the the previous one as shown by the same volume figure. So, I've simplified my routine to check when the current and previous values of barstatus are the same and the current and previous volume counts are the same (the previous values are stored in intrabarpersit variables). When both conditions are satisfied, I will treat the tick update as a repeat and so ignore it in some of my studies. Also, if barstatus = 2 and the current and previous volume counts are the same I will ignore that tick as well. I think this fixes all three issues. Note, all this is pertinent only when the study is set to update on every tick. I think this all works.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Good eyes. I did not even see that.The other thing you will notice is when the barstatus = 2 the tick is a repeat of the the previous one as shown by the same volume figure. So, I've simplified my routine to check when the current and previous values of barstatus are the same and the current and previous volume counts are the same (the previous values are stored in intrabarpersit variables). When both conditions are satisfied, I will treat the tick update as a repeat and so ignore it in some of my studies. Also, if barstatus = 2 and the current and previous volume counts are the same I will ignore that tick as well. I think this fixes all three issues. Note, all this is pertinent only when the study is set to update on every tick. I think this all works.
I have updated the notes on my print out to reflect the observation.
Yes, I will post the code once I'm satisfied it works. I'm almost certain it does but I like to give it a decent run through today.Yes, if the bug is a stable one... if it's a 'real' bug, or just a 'reporting' one...... I think this all works.
Would you mind pasting your code fix here, it will save us all some time. Thanks!
I'm not sure what you mean by a "reporting bug". Some might say it's not a real bug but simply the way studies are executed around the roll-over from one bar to the next. The issue though is the study is repeated with the same quote field values (OHLC, bid, ask, volume, etc.) under certain conditions, which presents a real problem for studies that perform intrabar computations and order executions. So, extra care must be taken to accommodate those situations. I can very well understand that it would require a major alteration to the way MC functions to "fix" these issues. So, I do not expect nor do I want them to fix them as I'm sure they have other pressing issues on their plate. Longer term though I do wish they rethink how studies are executed. As was discussed on another thread, a suggestion was made that studies be allowed to run at set intervals even when there is no tick update (eg, every 5 seconds). Barstatus could then be expanded so a study can decide to take the appropriate course of action.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Agree, this will add value to MultiCharts. On the other hand there is finite frequency at which studies can be reliably and consistently triggered, since Windows is Not a Real-Time Operating System - we may be looking at seconds triggering interval, at best.I also hope you take seriously the suggestion for and option to trigger a study at regular time intervals.