ProjectTemplateGen.mq5, standartlaştırılmış Uzman Danışman proje yapılarının oluşturulmasını otomatikleştiren bir MetaTrader 5 komut dosyası yardımcı programıdır. Ölçeklenebilir ticaret sistemi geliştirme için tutarlı bir temel oluştururken MQL5'in güvenlik kısıtlamaları dahilinde programatik dosya sistemi işlemlerini uygular.
Dosya İşlemleri Mimarisi
Kod, proje oluşturmanın farklı yönlerini ele alan farklı işlevlerle dosya oluşturmaya modüler bir yaklaşım uygular:
// OnStart() içinde birincil düzenleme string projectPath = "Files\\" + ProjectName + "\\"; if(!FolderCreate(projectPath)) { /* Hata işleme */ } if(!CreateMainEA(projectPath + ProjectName + ".mq5")) return; if(CreateIncludeFile) CreateInclude(projectPath + ProjectName + ".mqh"); CreateManifest(projectPath + "README.txt");
MQL5/Files/[ProjectName]/ ├── [ProjectName].mq5 # Main Expert Advisor source file ├── [ProjectName].mqh # Optional header/class definition file └── README.txt # Project documentation and instructions
1. Dinamik Yol Yapımı
string projectPath = "Files\\" + ProjectName + "\\";
2. Hata İşleme ile Sağlam Dosya Oluşturma
int h = FileOpen(filePath, FILE_WRITE | FILE_TXT | FILE_ANSI); if(h == INVALID_HANDLE) { Print("ERROR: Cannot create main EA file. Error: ", GetLastError()); return false; }
3. Yapılandırılmış İçerik Üretimi
FileWrite(h,"//+------------------------------------------------------------------+"); FileWrite(h,"//| " + ProjectName + ".mq5"); FileWrite(h,"//| Author: " + AuthorName); FileWrite(h,"#property strict"); FileWrite(h,"int OnInit()"); FileWrite(h,"{"); FileWrite(h," return INIT_SUCCEEDED;"); FileWrite(h,"}");
Temel Çalışma
Kod, MQL5 kod güvenlik kısıtlamaları nedeniyle projeleri MQL5\Files\[ProjectName]\ içinde oluşturur.
Kurulumu şu şekilde tamamlayın:
Ölçeklenebilirlik Geliştirmeleri

Kod :
//+------------------------------------------------------------------+ //|ProjectTemplateGen.mq5 | //|Telif Hakkı 2025, Clemence Benjamin | //|https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, Clemence Benjamin" #property link "https://www.mql5.com" #property strict #property description "Generates EA project template in MQL5//Files" #property script_show_inputs #property version "2.01" //--- Girişler input string ProjectName = "Type your project name";//Proje Adı input string AuthorName = "Type your name eg. Clemence Benjamin"; // Yazar Adı input bool CreateIncludeFile = true;// Bir başlık dosyası oluşturun //+------------------------------------------------------------------+ //| Senaryo girişi| //+------------------------------------------------------------------+ void OnStart() { Print("=== MQL5 Project Template Generator Started ==="); Print("Project Name: ", ProjectName); Print("Author: ", AuthorName); //--- İZİN VERİLEN sanal alan yolu string projectPath = "Files\\" + ProjectName + "\\"; Print("Target path (sandbox-safe): ", projectPath); //--- Proje klasörü oluşturun if(!FolderCreate(projectPath)) { Print("ERROR: Cannot create project folder. Error: ", GetLastError()); return; } //--- EA dosyası oluşturun if(!CreateMainEA(projectPath + ProjectName + ".mq5")) return; //--- include dosyası oluşturun if(CreateIncludeFile) CreateInclude(projectPath + ProjectName + ".mqh"); //--- Manifesto oluşturun CreateManifest(projectPath + "README.txt"); Print("SUCCESS: Project created in MQL5\\Files\\", ProjectName); Print("ACTION REQUIRED: Move folder to MQL5\\Experts\\ manually"); Print("Folder path: ", TerminalInfoString(TERMINAL_DATA_PATH) + "\\" + projectPath); } //+------------------------------------------------------------------+ //| Ana EA'yı oluşturun| //+------------------------------------------------------------------+ bool CreateMainEA(const string filePath) { int h = FileOpen(filePath, FILE_WRITE | FILE_TXT | FILE_ANSI); if(h == INVALID_HANDLE) { Print("ERROR: Cannot create main EA file. Error: ", GetLastError()); return false; } FileWrite(h,"//+------------------------------------------------------------------+"); FileWrite(h,"//| " + ProjectName + ".mq5"); FileWrite(h,"//| Author: " + AuthorName); FileWrite(h,"//+------------------------------------------------------------------+"); FileWrite(h,"#property strict"); FileWrite(h,""); FileWrite(h,"int OnInit()"); FileWrite(h,"{"); FileWrite(h," return INIT_SUCCEEDED;"); FileWrite(h,"}"); FileWrite(h,""); FileWrite(h,"void OnTick()"); FileWrite(h,"{"); FileWrite(h,"}"); FileClose(h); return true; } //+------------------------------------------------------------------+ //| include dosyası oluştur| //+------------------------------------------------------------------+ void CreateInclude(const string filePath) { int h = FileOpen(filePath, FILE_WRITE | FILE_TXT | FILE_ANSI); if(h == INVALID_HANDLE) return; FileWrite(h,"#ifndef __" + ProjectName + "_MQH__"); FileWrite(h,"#define __" + ProjectName + "_MQH__"); FileWrite(h,"class C" + ProjectName + " {};"); FileWrite(h,"#endif"); FileClose(h); } //+------------------------------------------------------------------+ //| Manifesto oluştur| //+------------------------------------------------------------------+ void CreateManifest(const string filePath) { int h = FileOpen(filePath, FILE_WRITE | FILE_TXT | FILE_ANSI); if(h == INVALID_HANDLE) return; FileWrite(h,"PROJECT TEMPLATE"); FileWrite(h,"Name: " + ProjectName); FileWrite(h,"Author: " + AuthorName); FileWrite(h,""); FileWrite(h,"NOTE:"); FileWrite(h,"Move this folder to MQL5\\Experts\\ to compile."); FileClose(h); } //+------------------------------------------------------------------+
MetaQuotes Ltd tarafından İngilizceden çevrilmiştir.
Orijinal kod: /en/code/68598
VR Breakdown level - Önceki High veya Low seviyesinin kırılmasına dayalı ticaret stratejisi
Önceki High veya Low seviyelerinin basit kırılmasına dayalı ticaret stratejisi
Session Time Filter Library
Filter trades by trading sessions (London, NY, Tokyo, Sydney)
EA Duplicate Detector
EA'nın koşullara bağlı olarak grafikte yinelenen EA'lar olup olmadığını belirlemesine izin verin.
Trade With MA
Trade using MA. An easy indicator to identify the trend direction on a specific timeframe.