Questions tagged [mql5]

MetaQuotes Language 5 (MQL5) is a built-in language for programming trading strategies. This language is developed by MetaQuotes Software Corp and allows to create your own Expert Advisors that make trading management automated and are perfectly suitable for implementing your own trading strategies. Besides, using MQL5 you can create your own technical indicators (custom indicators), scripts and libraries.

MQL5 contains a large number of functions necessary for analyzing current and previously received quotes and has built-in basic indicators and functions for managing trade positions and controlling them. The MetaEditor 5 (text editor) that highlights different constructions of MQL5 language is used for writing the program code. It helps users to orientate themselves in the expert system text quite easily.

MQL5 is the evolution of its predecessor - the MQL4 programming language, in which numerous indicators, scripts, and Expert Advisors were written. Despite the fact that the new programming language is maximally compatible with the previous-generation language, there are still some differences between these languages.

Check further details here: http://www.mql5.com/

404 questions
2
votes
3 answers

Changing stoploss in metatrader5 with python using Metatrader5 library and nothing happens

I have this code for changing stoploss on opened order/orders in metatrader 5. When I run this code nothing happens even when my compiler print that, nothing is wrong. I have algotrading on so I'm not sure where is the problem. Here is source…
Kurina11
  • 95
  • 1
  • 3
  • 13
2
votes
1 answer

How can I determine the strength of candlesticks programmatically?

Telling the strength of a candlestick is not straightforward in most cases. How can I combine the length of the upper and lower wicks and the body to wick ratios to arrive at a way of determining the strength of every candlestick type?
iGetIt
  • 695
  • 5
  • 20
2
votes
3 answers

sending order to open a position via MetaTrader5 python module and nothing happens

I followed Metatrader5 python documentation and this answer in stack overflow I try to open a sell position: import MetaTrader5 as mt5 ea_magic_number = 9986989 # if you want to give every bot a unique identifier def get_info(symbol): …
Kave McDaniel
  • 205
  • 4
  • 11
2
votes
1 answer

Logic for real-time Algo trading expert

I have made a trading expert that goes through candlesticks to check if a signal has been found then execute buy , sell orders for i in range (len(df['Open'])) : if some logic : buy or sell Now I want this expert to work on real-time data,…
mr.m
  • 312
  • 4
  • 15
2
votes
3 answers

How Close an MT5 Order from Python?

I'm trying to send orders from a python script to my MT5 terminal via the MT5-python API. I can open a position but how can I close it from Python mt5-API? I open a BUY ticket it like this: import MetaTrader5 as mt5 lot = 0.1 request = { "action":…
Swepy
  • 39
  • 1
  • 4
2
votes
1 answer

Program a handler for a stop loss

I would like to execute a series of commands every time when a stop loss (or take profit) automatically triggers. I am not sure how to do it, because I haven't found handlers for these events.
Bub Espinja
  • 4,029
  • 2
  • 29
  • 46
2
votes
1 answer

How to use enum with input in MQL5?

I created my enum: #property script_show_inputs enum MYENUM { first, second }; input MYENUM response; int OnInit() { if (response == first) { printf("first"); } if (response == second) { …
mr_blond
  • 1,586
  • 2
  • 20
  • 52
2
votes
1 answer

MQL5 Zmq PUB socket not being received by Python zmq SUB socket

I'm trying to set up a PUB socket in MQL5 and a SUB socket in Python that will receive messages. I have this in MQL5: #include Context context("helloworld"); Socket socket(context,ZMQ_PUB); string BROKER; int OnInit() { if…
IVlad
  • 43,099
  • 13
  • 111
  • 179
2
votes
0 answers

Client Socket not getting connect MQL5 with Python Server

The following is the scenario of me trying to connect the socket through MQL5 as client, but the server is from the Python. See the following: Server.py import socket def actual_work(): return 'dummy_reply' def main(): sock =…
Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
2
votes
1 answer

Reading the Lines of CSV file using MQL5

I am trying to read the last line time value from a csv file. Check the following: 2018-07-26 11:04:00 1.17272 1.17275 1.17267 1.17272 2018-07-26 11:05:00 1.17272 1.17273 1.17265 1.17268 2018-07-26 11:06:00 1.17268 1.17273 1.17261 1.17264 The…
Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
2
votes
1 answer

How to execute an OrderSend() function of MQL4 or MQL5 using cmd?

How to execute an OrderSend() function of MQL4 or MQL5 language using cmd script ?
2
votes
1 answer

Access to forward-testing statistics

I'm using the TesterStatistics() function (called from the OnDeinit() function) to export various strategy-testing statistical values: void OnDeinit(const int /*reason*/) { int h = FileOpen("results.txt",…
manlio
  • 18,345
  • 14
  • 76
  • 126
2
votes
1 answer

How to enter a new order only if / when the first one has been executed (filled)? [MQL5]

I'm kinda of new in MQL5. I have an EA that buys one stock first (let's say PETR4) and then buys another one (let's say ABEV3). The only problem is that I can only order the second one when the first one is executed (not only placed). I used the…
Lucas
  • 41
  • 4
2
votes
1 answer

How to modify a StopLoss of an active trade?

I have trouble with modifying the stoploss of a running trade using MQL5. Selecting the order works out for me. But if I try to access the variables ( for instance OrderTicket() & OrderOpenPrice() ), it always returns 0.00000: 2017.06.01…
Aurus
  • 173
  • 1
  • 5
  • 12
2
votes
2 answers

For a particular pair, how to get a total volume of open Long and Short positions on The Exchage?

In MQL4 ( MT4, MT5 ), how do I get the total volume of open Short and Long positions on the Exchange, for a current pair at the current time?
Amber More
  • 131
  • 1
  • 15
1 2
3
26 27