Get Historical Market Data for Charts and Analysis

This is an example on how to get historical Market Data. More info can be found in the learn section about charts.
When you are doing analysis, beware of corporate actions. They can result in a stock split, for example with a ratio of 1:2 where prices are halved. This is indicated by the DataVersion field.
On SIM, only prices for FxSpot are available, unless you connect your SIM account with your Live account.

Click button to launch function.

JS code:
Click button to show code.