MT5CompatSample_v1

Author: Copyright 2025, Amir Ghasemi Ltd.
Price Data Components
Series array that contains close prices for each barSeries array that contains open prices of each barSeries array that contains the lowest prices of each barSeries array that contains the highest prices of each bar
0 Views
0 Downloads
0 Favorites
MT5CompatSample_v1
ÿþ//+------------------------------------------------------------------+

//|                                              MT5CompatSample.mq5 |

//|                                Copyright 2025, Amir Ghasemi Ltd. |

//|                           https://www.mql5.com/en/users/amir.ghm |

//+------------------------------------------------------------------+

#property copyright "Copyright 2025, Amir Ghasemi Ltd."

#property link      "https://www.mql5.com/en/users/amir.ghm"

#property version   "1.00"

#property strict



// Uncomment this part

// #include<MT5Compat.mqh>



//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void OnStart() {

    string symbol = Symbol();      // Current symbol



    /* 

    

    // Get current Ask and Bid prices

    double askPrice = GetAsk();

    double bidPrice = GetBid();



    Print("Current Ask price: ", askPrice);

    Print("Current Bid price: ", bidPrice);



    // Retrieve symbol properties

    int digits = GetSymbolDigits(symbol);

    double tickSize = GetSymbolTickSize(symbol);

    double tickValue = GetSymbolTickValue(symbol);

    double minLot = GetSymbolMinLot(symbol);

    double pointSize = GetSymbolPoint(symbol);

    long spread = GetSymbolSpread(symbol);



    Print("Symbol properties for ", symbol, ":");

    Print("  Digits: ", digits);

    Print("  Tick Size: ", tickSize);

    Print("  Tick Value: ", tickValue);

    Print("  Min Lot: ", minLot);

    Print("  Point Size: ", pointSize);

    Print("  Spread: ", spread);

    

    */



    // Retrieve bar prices using iClose, iOpen, iLow, and iHigh

    int barIndex = 1;  // The bar index to analyze

    double closePrice = iClose(symbol, PERIOD_CURRENT, barIndex);

    double openPrice = iOpen(symbol, PERIOD_CURRENT, barIndex);

    double lowPrice = iLow(symbol, PERIOD_CURRENT, barIndex);

    double highPrice = iHigh(symbol, PERIOD_CURRENT, barIndex);



    Print("Bar prices for index ", barIndex, ":");

    Print("  Close Price: ", closePrice);

    Print("  Open Price: ", openPrice);

    Print("  Low Price: ", lowPrice);

    Print("  High Price: ", highPrice);

}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---