Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Ian Venner
2583
Ian Venner 2014.03.17 17:29  

Ok I have found the cause of this bug, It is not the chart.ini file, it is the profile folder each chart has a .chr file, when time the terminal is closed the chart objects are saved there in the order they were listed in the chart objects list. This appears to be the sequence of events when closing and restarting the terminal

  • Objects placed on chart by script in correct order
  • Terminal closed, objects saved in .chr file in the order at which they were placed.
  • Terminal restarted, objects are loaded from the .chr file in REVERSE order, so layering on the chart is reversed.
  • Terminal closed, objects saved in .chr file in that reverse order.
  • Terminal restarted, objects loaded from .chr in reverse again, so they are now back to correct on the chart again.
  • This cycle of reverrsal and re-reversal continues every time the terminal is closed and restarted.

When I close the terminal this is the .chr file that is generated.

<window>
height=133
< indicator>
name=main
< object>
type=28
object_name=shape0
period_flags=0
create_time=1395076247
description=RectangleLabel
color=8421504
font=Arial
fontsize=10
background=0
corner=0
x_distance=100
y_distance=100
size_x=100
size_y=100
bgcolor=255
border_type=2
< /object>
< object>
type=28
object_name=shape1
period_flags=0
create_time=1395076247
description=RectangleLabel
color=8421504
font=Arial
fontsize=10
background=0
corner=0
x_distance=110
y_distance=110
size_x=100
size_y=100
bgcolor=16711680
border_type=2
< /object>
< object>
type=28
object_name=shape2
period_flags=0
create_time=1395076247
description=RectangleLabel
color=8421504
font=Arial
fontsize=10
background=0
corner=0
x_distance=120
y_distance=120
size_x=100
size_y=100
bgcolor=32768
border_type=2
< /object>
< /indicator>
< /window>

When I restart the terminal objects will be loaded from this file, but in reverse order. So the layering will be incorrect on the chart.

Ian Venner
2583
Ian Venner 2014.03.17 17:35  

Now I will close the terminal again and then look at the .chr file again.

This is the .chr file after terminal is closed. You can see the object order is reversed. (as the objects were on the chart)

<window>
height=133
<indicator>
name=main
<object>
type=28
object_name=shape2
period_flags=0
create_time=1395076247
description=RectangleLabel
color=8421504
font=Arial
fontsize=10
background=0
corner=0
x_distance=120
y_distance=120
size_x=100
size_y=100
bgcolor=32768
border_type=2
</object>
<object>
type=28
object_name=shape1
period_flags=0
create_time=1395076247
description=RectangleLabel
color=8421504
font=Arial
fontsize=10
background=0
corner=0
x_distance=110
y_distance=110
size_x=100
size_y=100
bgcolor=16711680
border_type=2
</object>
<object>
type=28
object_name=shape0
period_flags=0
create_time=1395076247
description=RectangleLabel
color=8421504
font=Arial
fontsize=10
background=0
corner=0
x_distance=100
y_distance=100
size_x=100
size_y=100
bgcolor=255
border_type=2
</object>
</indicator>
</window>

This time when I restart the terminal the objects will be loaded from this file in reverse again, so they will go back to being correct on the chart. (Until the next time the terminal is closed and restarted.)

Slawa
Moderator
6804
Slawa 2014.03.18 09:48  

Thank you. Fixed

Please wait for the next build

Ian Venner
2583
Ian Venner 2014.03.18 15:30  

You are welcome stringo.

/ /12
To add comments, please log in or register