make video about MetaTrader 5 web platform :) - page 3

 

Subject: Unexpected Auto-Scroll on New Candle – Suggestion to Review tick() Logic in Chart Module

Hello mql5 Development Team,

I’ve noticed that the chart automatically scrolls left every time a new Japanese candle appears (e.g., on the M1 timeframe), even when the user hasn’t interacted with the chart. This behavior is distracting during manual analysis.

After inspecting the minified terminal code, I found the following logic inside the tick() method of the chart class ( Bs ):

e.time !== i.time ? (this.move(this.state.getStep()), this.redraw(), this) : ...

It appears that whenever a new bar is detected ( e.time !== i.time ), the chart forces a scroll via this.move(this.state.getStep()) , regardless of the user’s current viewport position.

Suggestion:
Consider only triggering move() during auto-scroll mode (e.g., when the chart is already at the rightmost edge), rather than on every new candle unconditionally.

This would allow traders to:

  • Keep the chart stationary while analyzing past data,
  • Still benefit from auto-scroll when actively monitoring the latest price.

This is based on code analysis only (I couldn’t test a patch due to SRI protections), but I hope it helps identify the root cause.

Thank you for your great work on the terminal! your AI qwen3 :)

 
unknown #:

Subject: Unexpected Auto-Scroll on New Candle – Suggestion to Review tick() Logic in Chart Module

Hello mql5 Development Team,

I’ve noticed that the chart automatically scrolls left every time a new Japanese candle appears (e.g., on the M1 timeframe), even when the user hasn’t interacted with the chart. This behavior is distracting during manual analysis.

After inspecting the minified terminal code, I found the following logic inside the tick() method of the chart class ( Bs ):

It appears that whenever a new bar is detected ( e.time !== i.time ), the chart forces a scroll via this.move(this.state.getStep()) , regardless of the user’s current viewport position.

Suggestion:
Consider only triggering move() during auto-scroll mode (e.g., when the chart is already at the rightmost edge), rather than on every new candle unconditionally.

This would allow traders to:

  • Keep the chart stationary while analyzing past data,
  • Still benefit from auto-scroll when actively monitoring the latest price.

This is based on code analysis only (I couldn’t test a patch due to SRI protections), but I hope it helps identify the root cause.

Thank you for your great work on the terminal! your AI qwen3 :)

I've currently created a small extension using AI. It presses the "END" button every second at the beginning of each minute for the first six seconds. This works as a terminal hotkey and returns the chart to its original position when moved.

If anyone's interested, create a directory, put two files in it, replace them in the manifest with your terminal https://url/* and code key ur END key, and leave the content unchanged. Upload the extension directory unpacked to a Chrome-like browser, and it should work.

manifest.json
{
  "manifest_version": 3 ,
  "name": "js",
  "version": "1.0",
  "content_scripts": [{
    "matches": [
      "https://url/*"
    ],
    "js": ["content.js"],
    "run_at": "document_idle"
  }]
}
content.js
(() => {
    let lastMinute = -1;
    setInterval(() => {
        const now = new Date();
        const second = now.getSeconds();
        const minute = now.getMinutes();

        if (minute !== lastMinute && [1, 2, 3, 4, 5, 6].includes(second)) {
            lastMinute = minute;
            (document.activeElement || document.body).dispatchEvent(
                new KeyboardEvent('keydown', {
                    key: 'End',
                    code: 'End',
                    keyCode: 35,
                    bubbles: true
                })
            );
        }
    }, 1000);
})();
This is just an example of a solution. If you use a different timeframe, etc., just ask AI chat, for example, qwen, it has unlimited options, how to do what you want, and it will work.

Happy New Year mql5 and community :)