Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Scripts

Script to extract Candlesticks data from all time frames to CSV. - script pour MetaTrader 5

Vues:
2657
Note:
(4)
Publié:
2024.10.15 05:29
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

Overview of the CandlesticksData Script

The CandlesticksData script is designed for the MetaTrader 5 trading platform, allowing traders and developers to export detailed candlestick data into a CSV file for further analysis or record-keeping. This script is particularly useful for quantitative analysis, backtesting trading strategies, or for educational purposes, enabling users to examine historical price movements comprehensively.

Purpose

The primary purpose of the CandlesticksData script is to gather and organize candlestick data across various timeframes and save it in a structured format. This functionality assists traders in identifying market trends, patterns, and behaviors, making it easier to make informed trading decisions. By exporting this data, users can leverage external tools or software for more complex analyses, such as statistical assessments or machine learning applications.

Functionality

  1. Initialization and Inputs: The script begins by defining properties and initializing necessary variables. It includes an enumeration for timeframes and prepares to capture data from the latest 21 candlesticks.

  2. Timeframe Selection: The TimeFrameHandle function assigns specific timeframes based on the input index, allowing the user to choose from various candlestick intervals, including minutes, hours, daily, weekly, and monthly data.

  3. Data Collection: Within the OnStart function, the script iterates through the defined timeframes and calls the CandlesticksData function for data collection. This function retrieves key data points for each candlestick, including:

    • Open, High, Low, and Close Prices: Essential indicators of price movement within each period.
    • Tick Volume and Volume: Measures of trading activity and liquidity.
    • Spread: The difference between bid and ask prices.
    • Candlestick Characteristics: This includes calculating the sizes of the candlestick body, wicks, and their types (bullish or bearish).
  4. Data Writing: The script formats the collected data into a CSV file. It starts by writing a header row for clarity, followed by detailed entries for each candlestick. This includes the index, date, time, prices, volume metrics, and additional calculated values such as the previous close price and candle range differences.

  5. Error Handling: The script includes error checks to ensure successful file creation and writing. If any issues arise, it outputs an error message to the console.

  6. Completion Notification: Upon successfully saving the data, the script alerts the user about the file location, providing easy access to the exported data for further use.

Conclusion

The CandlesticksData script serves as a valuable tool for traders seeking to analyze historical market data efficiently. By automating the data extraction process and organizing it in a user-friendly format, the script enables enhanced trading strategy development and evaluation.


Simplest Logger class for MetaTrader 5 Simplest Logger class for MetaTrader 5

The simplest class for logging in MetaTrader 5 with support for levels, message format, include and exclude filters on substrings.

TimeServerDaylightSavings TimeServerDaylightSavings

Time-related functions for empirical detection of server time zone and daylight savings mode (DST) from history of quotes

Push Notification for Opened / Closed Trades (Netting) Push Notification for Opened / Closed Trades (Netting)

This code provides a simple function for sending push notifications to your mobile device whenever trades are opened or closed in MetaTrader 5. It's designed for netting accounts (where only one position per symbol is allowed).

Sample pine script stochastic divergence converted to MQL5 Sample pine script stochastic divergence converted to MQL5

A sample pine code converted to MQL