MQL5
1 program
Added 2025-10-29T11:01:38Z
Model: google/gemini-2.5-proTemp: 0.4
Evidence
Report issue
View issues
Aliases: MetaQuotes Language 5
Provenance: commit dab3410a84 · authored 2025-10-29T12:01:38+01:00 · model google/gemini-2.5-pro
Sources mentioning this language
4 sources · pl_id:
pl/mql5Extensions claimed by this language
5 claims. Each row is one upstream assertion with its strength.
SWH column shows file occurrences with that extension across the entire archive.| Extension | Source | Strength | SWH |
|---|---|---|---|
.mq4 | pygments | primary | 71.6K files |
.mq5 | linguist | primary | 27.2K files |
.mq5 | pygments | secondary | 27.2K files |
.mqh | linguist | secondary | 80.6K files |
.mqh | pygments | secondary | 80.6K files |
Related languages
LLM-contributed programs
Close Positions on Total Profit
Provenance: commit dab3410a84 · authored 2025-10-29T12:01:38+01:00 · model google/gemini-2.5-pro · Temp 0.4
//+------------------------------------------------------------------+
//| CloseOnTotalProfit_Sample.mq5|
//| Copyright 2009, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2009, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
/*
A simple EA that closes all positions when the total profit reaches a certain level
*/
//--- input parameters
input double ProfitLevel=10.0; // Profit level to close all positions
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
double total_profit=0;
//--- go through all open positions
for(int i=PositionsTotal()-1;i>=0;i--)
{
//--- get position properties
ulong position_ticket=PositionGetTicket(i);
string position_symbol=PositionGetString(POSITION_SYMBOL);
long magic=PositionGetInteger(POSITION_MAGIC);
double volume=PositionGetDouble(POSITION_VOLUME);
double price_open=PositionGetDouble(POSITION_PRICE_OPEN);
double price_current=PositionGetDouble(POSITION_PRICE_CURRENT);
long type=PositionGetInteger(POSITION_TYPE);
double profit=PositionGetDouble(POSITION_PROFIT);
//--- calculate total profit
total_profit+=profit;
}
//--- check the total profit
if(total_profit>=ProfitLevel)
{
//--- close all positions
for(int i=PositionsTotal()-1;i>=0;i--)
{
//--- get position ticket
ulong position_ticket=PositionGetTicket(i);
//--- create trade request
MqlTradeRequest request;
MqlTradeResult result;
//---
request.action=TRADE_ACTION_DEAL;
request.position=position_ticket;
//--- send order
OrderSend(request,result);
}
}
}
//+------------------------------------------------------------------+
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)