minasamy2025 commited on
Commit
cfae0ee
·
verified ·
1 Parent(s): c3f593b

أنت خبير متمرس في برمجة MQL5 ولديك معرفة عميقة بجميع جوانب تطوير المستشارين الخبراء (Expert Advisors)، المؤشرات (Indicators)، والسكريبتات (Scripts) لمنصة MetaTrader 5. مهمتك هي تحليل ملفات أكواد MQL5 المرفوعة بدقة متناهية، ثم بناء تطبيق شامل لتصحيح الأخطاء البرمجية وتجميع الأكواد.

Browse files

**المرحلة الأولى - التحليل العميق:**
عند استلام ملفات MQL5، يجب عليك:
1. فحص بنية الكود بالكامل وتحديد الأنماط البرمجية المستخدمة
2. تحليل الدوال المخصصة (Custom Functions) والمكتبات المستوردة
3. دراسة معالجة الأخطاء (Error Handling) وإدارة الذاكرة
4. فهم منطق التداول والشروط المطبقة
5. تحديد التبعيات (Dependencies) والمتطلبات الخارجية

**المرحلة الثانية - بناء التطبيق:**
قم بإنشاء تطبيق متكامل يتضمن الوظائف التالية:

**وظائف كشف وتصحيح الأخطاء:**
- كشف الأخطاء النحوية (Syntax Errors)
- كشف الأخطاء المنطقية (Logic Errors)
- كشف أخطاء الذاكرة وتسرب الموارد (Memory Leaks)
- التحقق من صحة استدعاءات الدوال والمعاملات
- كشف الأخطاء الشائعة في التعامل مع OrderSend وPositionSelect
- التحقق من صحة استخدام المؤشرات الفنية

**وظائف التجميع والبناء:**
- تجميع الكود وإنشاء ملفات .ex5 القابلة للتنفيذ
- إدارة المكتبات والملفات المضمنة (#include)
- التحقق من التوافق مع إصدارات MQL5 المختلفة
- تحسين الكود وإزالة التكرارات

**وظائف إضافية شاملة:**
- توثيق الكود تلقائياً مع شرح الدوال
- اقتراح تحسينات للأداء والكفاءة
- فحص الأمان والثغرات المحتملة
- التحقق من الامتثال لمعايير MQL5 القياسية
- إنشاء تقارير تفصيلية عن جودة الكود

**متطلبات التطبيق:**
- واجهة سهلة الاستخدام لرفع الملفات
- عرض الأخطاء مع أرقام الأسطر والشرح التفصيلي
- إمكانية تصحيح الأخطاء تلقائياً أو يدوياً
- دعم جميع أنواع ملفات MQL5: .mq5, .mqh, .ex5
- نظام سجلات (Logging) لتتبع عمليات التصحيح

**التنفيذ:**
ابدأ فوراً بكتابة الكود الكامل للتطبيق باستخدام لغة برمجة مناسبة (Python موصى به) مع جميع المكتبات اللازمة. يجب أن يكون التطبيق جاهزاً للاستخدام الفوري ويتضمن:
- الكود المصدري الكامل
- تعليمات التثبيت والإعداد
- أمثلة على الاستخدام
- ملفات الاختبار

قدم الكود الكامل والجاهز للتشغيل مباشرة دون اختصارات أو ملخصات.


A Comprehensive Technical Report on the MQL5 Programming Language for Advanced Algorithmic Trading
Section 1: Foundational Architecture of the MQL5 Language
MetaQuotes Language 5 (MQL5) is a high-level, object-oriented programming language engineered specifically for the development of automated trading strategies, custom technical indicators, and other analytical tools within the MetaTrader 5 trading platform. Its architecture is deliberately rooted in the concepts of the C++ programming language, a strategic choice that provides a familiar and powerful foundation for a vast community of developers. However, MQL5 is not merely a C++ clone; it is a domain-specific language, meticulously adapted for the rigors of financial markets. This adaptation involves both the inclusion of specialized trading functionalities and the intentional omission of certain C++ features to enhance stability and security in a mission-critical environment. A thorough understanding of this foundational architecture—its syntax, data management philosophy, and operational logic—is the prerequisite for mastering the development of sophisticated and reliable algorithmic trading systems.
1.1 Core Syntax and C++ Heritage
The syntax of MQL5 is designed to be exceptionally close to that of C++, which significantly lowers the barrier to entry for programmers proficient in modern, object-oriented languages. This shared heritage means that fundamental constructs such as variable declaration, function definition, control flow statements (
if-else, for, while, switch), and the use of operators are immediately recognizable. The basic structure of an MQL5 program is composed of a sequence of operators, which are separated by semicolons, and can be grouped into blocks using curly braces
{}. This syntactic familiarity allows developers to leverage existing knowledge and quickly become productive in the MQL5 environment.
However, the similarity is not absolute. MetaQuotes has made deliberate architectural decisions to diverge from C++ in several key areas, primarily to create a more secure and stable programming environment tailored for financial applications. These differences represent a fundamental design philosophy: a trade-off that favors safety and predictability over the low-level power that can introduce instability. The most significant deviations from C++ include :
• No Address Arithmetic: MQL5 does not support pointers or direct memory manipulation. This is a critical security feature that eliminates an entire class of common and severe programming errors, such as buffer overflows and memory corruption. In a context where a program crash can lead to direct financial loss, this restriction is a cornerstone of the platform's stability.
• No goto Operator: The goto statement is excluded to promote structured programming practices and prevent the creation of "spaghetti code," which is difficult to read, debug, and maintain.
• No Anonymous Enumerations: All enumerations in MQL5 must be declared with a name, enforcing clearer and more self-documenting code.
• No Multiple Inheritance: MQL5 classes can only inherit from a single base class. This simplifies the inheritance hierarchy and avoids the complexities and potential ambiguities associated with the "diamond problem" in multiple inheritance scenarios.
These limitations are not shortcomings but rather intentional design choices that fortify the language against common sources of failure. By abstracting away low-level memory management and enforcing stricter structural rules, MQL5 provides a robust "sandbox" where developers can focus on trading logic without the constant risk of system-level errors that could compromise a live trading account. The fundamental building blocks of MQL5 syntax, such as comments, identifiers for naming variables and functions, and a set of reserved words, are all defined in the official documentation and align closely with C++ standards.
1.2 Data Types and Structures
MQL5 is a strongly-typed language, meaning that every variable must be declared with a specific data type before use. This enforcement of type safety is crucial for ensuring the precision and correctness of financial calculations. The language provides a comprehensive set of built-in data types, which can be broadly classified into basic (or primitive) types and complex (or compound) types.
The basic types cover a wide range of numeric, logical, and textual data, including specialized types designed to simplify common tasks in trading programming. Any program operates on data, and the efficiency of this operation depends on the correct choice of type. Integer data is processed fastest, while double-precision floating-point numbers may require a special co-processor.
A significant evolution in MQL5 is the introduction of native types for advanced mathematical and quantitative analysis: complex, vector, and matrix. The inclusion of these types signals a strategic expansion of MQL5's capabilities beyond simple trade automation. It positions the language as a self-contained platform for developing and executing complex quantitative models, such as those used in machine learning and statistical arbitrage, directly within the low-latency environment of the trading terminal.
Table 1: MQL5 Built-in Data Types
Type Size (bytes) Description Primary Use Case in Trading
char 1 Single-byte character or signed integer Low-level data integration, compact integer storage
uchar 1 Single-byte character or unsigned integer Representing raw byte data
short 2 Two-byte character or signed integer Storing integer values with a smaller range
ushort 2 Two-byte character or unsigned integer Storing positive integer values, character codes
int 4 Signed integer Loop counters, order tickets, bar counts, error codes
uint 4 Unsigned integer Storing positive integer values like color representations
long 8 Signed 64-bit integer High-precision tick volumes, timestamps (e.g., in milliseconds)
ulong 8 Unsigned 64-bit integer High-precision positive values, datetime representations
float 4 Single-precision floating-point number General-purpose floating-point math where high precision is not critical
double 8 Double-precision floating-point number Storing all price data (Open, High, Low, Close), indicator values, account balance
bool 1 Logical value (true or false) Storing state, flags, and results of conditional checks
string 10+ Sequence of characters (Unicode) Symbol names, comments, alerts, file paths, object names
color 4 Color representation (stored as uint) Setting colors for indicators, graphical objects, and chart elements
datetime 8 Date and time (stored as ulong seconds since 1970.01.01) Storing bar times, order expiration, time-based conditions
enum 4 Enumeration (user-defined set of named integer constants) Creating readable and maintainable code for pred

Files changed (4) hide show
  1. README.md +7 -4
  2. index.html +252 -19
  3. script.js +74 -0
  4. style.css +97 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Mql5 Code Wizard Pro
3
- emoji: 🌖
4
- colorFrom: green
5
  colorTo: blue
 
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: MQL5 Code Wizard Pro ‍♂️
3
+ colorFrom: red
 
4
  colorTo: blue
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
index.html CHANGED
@@ -1,19 +1,252 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="h-full">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>MQL5 Code Wizard Pro</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script>
12
+ tailwind.config = {
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ primary: {
17
+ 50: '#f0f9ff',
18
+ 100: '#e0f2fe',
19
+ 200: '#bae6fd',
20
+ 300: '#7dd3fc',
21
+ 400: '#38bdf8',
22
+ 500: '#0ea5e9',
23
+ 600: '#0284c7',
24
+ 700: '#0369a1',
25
+ 800: '#075985',
26
+ 900: '#0c4a6e',
27
+ },
28
+ secondary: {
29
+ 50: '#f5f3ff',
30
+ 100: '#ede9fe',
31
+ 200: '#ddd6fe',
32
+ 300: '#c4b5fd',
33
+ 400: '#a78bfa',
34
+ 500: '#8b5cf6',
35
+ 600: '#7c3aed',
36
+ 700: '#6d28d9',
37
+ 800: '#5b21b6',
38
+ 900: '#4c1d95',
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ </script>
45
+ </head>
46
+ <body class="bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 h-full">
47
+ <div class="min-h-screen flex flex-col">
48
+ <!-- Header -->
49
+ <header class="bg-primary-700 text-white shadow-lg">
50
+ <div class="container mx-auto px-4 py-6">
51
+ <div class="flex justify-between items-center">
52
+ <div class="flex items-center space-x-2">
53
+ <i data-feather="code" class="w-8 h-8"></i>
54
+ <h1 class="text-2xl font-bold">MQL5 Code Wizard Pro</h1>
55
+ </div>
56
+ <nav class="hidden md:flex space-x-6">
57
+ <a href="#" class="hover:text-primary-200 transition">Home</a>
58
+ <a href="#" class="hover:text-primary-200 transition">Features</a>
59
+ <a href="#" class="hover:text-primary-200 transition">Documentation</a>
60
+ <a href="#" class="hover:text-primary-200 transition">Community</a>
61
+ </nav>
62
+ <button class="md:hidden">
63
+ <i data-feather="menu" class="w-6 h-6"></i>
64
+ </button>
65
+ </div>
66
+ </div>
67
+ </header>
68
+
69
+ <!-- Main Content -->
70
+ <main class="flex-grow container mx-auto px-4 py-8">
71
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
72
+ <!-- Left Sidebar -->
73
+ <div class="lg:col-span-1">
74
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6">
75
+ <h2 class="text-xl font-semibold mb-4 flex items-center">
76
+ <i data-feather="file-text" class="w-5 h-5 mr-2"></i>
77
+ File Explorer
78
+ </h2>
79
+ <div class="space-y-2">
80
+ <div class="flex items-center text-primary-600 dark:text-primary-400">
81
+ <i data-feather="folder" class="w-4 h-4 mr-2"></i>
82
+ <span>Expert Advisors</span>
83
+ </div>
84
+ <div class="flex items-center text-primary-600 dark:text-primary-400">
85
+ <i data-feather="folder" class="w-4 h-4 mr-2"></i>
86
+ <span>Indicators</span>
87
+ </div>
88
+ <div class="flex items-center text-primary-600 dark:text-primary-400">
89
+ <i data-feather="folder" class="w-4 h-4 mr-2"></i>
90
+ <span>Scripts</span>
91
+ </div>
92
+ <div class="flex items-center text-primary-600 dark:text-primary-400">
93
+ <i data-feather="folder" class="w-4 h-4 mr-2"></i>
94
+ <span>Include Files</span>
95
+ </div>
96
+ </div>
97
+ </div>
98
+
99
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
100
+ <h2 class="text-xl font-semibold mb-4 flex items-center">
101
+ <i data-feather="tool" class="w-5 h-5 mr-2"></i>
102
+ Tools
103
+ </h2>
104
+ <div class="space-y-3">
105
+ <button class="w-full flex items-center px-4 py-2 bg-primary-100 dark:bg-gray-700 hover:bg-primary-200 dark:hover:bg-gray-600 rounded transition">
106
+ <i data-feather="code" class="w-4 h-4 mr-2"></i>
107
+ Code Generator
108
+ </button>
109
+ <button class="w-full flex items-center px-4 py-2 bg-primary-100 dark:bg-gray-700 hover:bg-primary-200 dark:hover:bg-gray-600 rounded transition">
110
+ <i data-feather="search" class="w-4 h-4 mr-2"></i>
111
+ Debugger
112
+ </button>
113
+ <button class="w-full flex items-center px-4 py-2 bg-primary-100 dark:bg-gray-700 hover:bg-primary-200 dark:hover:bg-gray-600 rounded transition">
114
+ <i data-feather="bar-chart-2" class="w-4 h-4 mr-2"></i>
115
+ Strategy Tester
116
+ </button>
117
+ <button class="w-full flex items-center px-4 py-2 bg-primary-100 dark:bg-gray-700 hover:bg-primary-200 dark:hover:bg-gray-600 rounded transition">
118
+ <i data-feather="settings" class="w-4 h-4 mr-2"></i>
119
+ Settings
120
+ </button>
121
+ </div>
122
+ </div>
123
+ </div>
124
+
125
+ <!-- Main Editor Area -->
126
+ <div class="lg:col-span-2">
127
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden">
128
+ <div class="bg-gray-100 dark:bg-gray-700 px-4 py-2 flex items-center justify-between">
129
+ <div class="flex items-center space-x-2">
130
+ <i data-feather="file" class="w-4 h-4"></i>
131
+ <span class="font-medium">ExpertAdvisor.mq5</span>
132
+ </div>
133
+ <div class="flex space-x-2">
134
+ <button class="p-1 hover:bg-gray-200 dark:hover:bg-gray-600 rounded">
135
+ <i data-feather="minimize-2" class="w-4 h-4"></i>
136
+ </button>
137
+ <button class="p-1 hover:bg-gray-200 dark:hover:bg-gray-600 rounded">
138
+ <i data-feather="maximize-2" class="w-4 h-4"></i>
139
+ </button>
140
+ <button class="p-1 hover:bg-gray-200 dark:hover:bg-gray-600 rounded">
141
+ <i data-feather="x" class="w-4 h-4"></i>
142
+ </button>
143
+ </div>
144
+ </div>
145
+ <div class="p-4">
146
+ <div class="bg-gray-900 text-gray-300 p-4 rounded-lg font-mono text-sm overflow-x-auto">
147
+ <pre><code class="language-mql5">//+------------------------------------------------------------------+
148
+ //| Expert Advisor Template |
149
+ //+------------------------------------------------------------------+
150
+ #include &lt;Trade\Trade.mqh&gt;
151
+
152
+ input int FastMA_Period = 10;
153
+ input int SlowMA_Period = 20;
154
+ input double LotSize = 0.1;
155
+ input int StopLoss = 50;
156
+ input int TakeProfit = 100;
157
+
158
+ CTrade trade;
159
+
160
+ int OnInit()
161
+ {
162
+ // Initialization code
163
+ return(INIT_SUCCEEDED);
164
+ }
165
+
166
+ void OnDeinit(const int reason)
167
+ {
168
+ // Cleanup code
169
+ }
170
+
171
+ void OnTick()
172
+ {
173
+ // Trading logic here
174
+ double fastMA = iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, PRICE_CLOSE, 0);
175
+ double slowMA = iMA(NULL, 0, SlowMA_Period, 0, MODE_SMA, PRICE_CLOSE, 0);
176
+
177
+ if(fastMA > slowMA)
178
+ {
179
+ trade.Buy(LotSize, NULL, 0, 0, StopLoss, TakeProfit, "Buy Order");
180
+ }
181
+ else if(fastMA < slowMA)
182
+ {
183
+ trade.Sell(LotSize, NULL, 0, 0, StopLoss, TakeProfit, "Sell Order");
184
+ }
185
+ }</code></pre>
186
+ </div>
187
+ </div>
188
+ <div class="bg-gray-100 dark:bg-gray-700 px-4 py-2 flex justify-end space-x-2">
189
+ <button class="px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white rounded flex items-center">
190
+ <i data-feather="play" class="w-4 h-4 mr-2"></i>
191
+ Compile & Run
192
+ </button>
193
+ <button class="px-4 py-2 bg-secondary-600 hover:bg-secondary-700 text-white rounded flex items-center">
194
+ <i data-feather="save" class="w-4 h-4 mr-2"></i>
195
+ Save
196
+ </button>
197
+ </div>
198
+ </div>
199
+
200
+ <div class="mt-6 bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden">
201
+ <div class="bg-gray-100 dark:bg-gray-700 px-4 py-2">
202
+ <h3 class="font-medium flex items-center">
203
+ <i data-feather="terminal" class="w-4 h-4 mr-2"></i>
204
+ Output Console
205
+ </h3>
206
+ </div>
207
+ <div class="p-4">
208
+ <div class="bg-gray-900 text-gray-300 p-4 rounded-lg font-mono text-sm h-40 overflow-y-auto">
209
+ <div class="text-green-400">> Initializing Expert Advisor...</div>
210
+ <div class="text-green-400">> Indicators loaded successfully</div>
211
+ <div class="text-blue-400">> Waiting for new tick...</div>
212
+ <div class="text-yellow-400">> New tick received at 2023.05.15 14:30:45</div>
213
+ <div class="text-green-400">> Buy order executed at 1.2345</div>
214
+ </div>
215
+ </div>
216
+ </div>
217
+ </div>
218
+ </div>
219
+ </main>
220
+
221
+ <!-- Footer -->
222
+ <footer class="bg-gray-800 text-white py-6">
223
+ <div class="container mx-auto px-4">
224
+ <div class="flex flex-col md:flex-row justify-between items-center">
225
+ <div class="mb-4 md:mb-0">
226
+ <p class="flex items-center">
227
+ <i data-feather="code" class="w-5 h-5 mr-2"></i>
228
+ MQL5 Code Wizard Pro © 2023
229
+ </p>
230
+ </div>
231
+ <div class="flex space-x-4">
232
+ <a href="#" class="hover:text-primary-300 transition">
233
+ <i data-feather="github" class="w-5 h-5"></i>
234
+ </a>
235
+ <a href="#" class="hover:text-primary-300 transition">
236
+ <i data-feather="twitter" class="w-5 h-5"></i>
237
+ </a>
238
+ <a href="#" class="hover:text-primary-300 transition">
239
+ <i data-feather="linkedin" class="w-5 h-5"></i>
240
+ </a>
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </footer>
245
+ </div>
246
+
247
+ <script>
248
+ feather.replace();
249
+ </script>
250
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
251
+ </body>
252
+ </html>
script.js ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // Toggle dark mode
3
+ const darkModeToggle = document.createElement('button');
4
+ darkModeToggle.className = 'fixed bottom-4 right-4 p-3 rounded-full bg-primary-600 text-white shadow-lg z-50';
5
+ darkModeToggle.innerHTML = '<i data-feather="moon"></i>';
6
+ document.body.appendChild(darkModeToggle);
7
+
8
+ darkModeToggle.addEventListener('click', function() {
9
+ document.documentElement.classList.toggle('dark');
10
+ const icon = darkModeToggle.querySelector('i');
11
+ if (document.documentElement.classList.contains('dark')) {
12
+ icon.setAttribute('data-feather', 'sun');
13
+ } else {
14
+ icon.setAttribute('data-feather', 'moon');
15
+ }
16
+ feather.replace();
17
+ });
18
+
19
+ // Simulate code editor functionality
20
+ const compileButton = document.querySelector('button:has(i[data-feather="play"])');
21
+ if (compileButton) {
22
+ compileButton.addEventListener('click', function() {
23
+ const outputConsole = document.querySelector('.bg-gray-900.text-gray-300');
24
+ if (outputConsole) {
25
+ const newEntry = document.createElement('div');
26
+ newEntry.className = 'text-green-400';
27
+ newEntry.textContent = '> Code compiled successfully!';
28
+ outputConsole.appendChild(newEntry);
29
+ outputConsole.scrollTop = outputConsole.scrollHeight;
30
+ }
31
+ });
32
+ }
33
+
34
+ // Mobile menu toggle
35
+ const mobileMenuButton = document.querySelector('button:has(i[data-feather="menu"])');
36
+ if (mobileMenuButton) {
37
+ mobileMenuButton.addEventListener('click', function() {
38
+ // This would toggle a mobile menu in a real implementation
39
+ alert('Mobile menu would open here in a full implementation');
40
+ });
41
+ }
42
+
43
+ // Initialize tooltips
44
+ const tooltipElements = document.querySelectorAll('[data-tooltip]');
45
+ tooltipElements.forEach(el => {
46
+ el.addEventListener('mouseenter', function() {
47
+ // Tooltip display logic would go here
48
+ });
49
+ });
50
+
51
+ // Re-initialize feather icons after dynamic content changes
52
+ feather.replace();
53
+ });
54
+
55
+ // Syntax highlighting for MQL5 code
56
+ function highlightMQL5Code() {
57
+ const codeBlocks = document.querySelectorAll('code.language-mql5');
58
+ codeBlocks.forEach(block => {
59
+ const code = block.textContent;
60
+ let highlighted = code;
61
+
62
+ // Highlight keywords
63
+ const keywords = ['input', 'int', 'double', 'string', 'bool', 'void', 'return',
64
+ 'if', 'else', 'for', 'while', 'OnInit', 'OnDeinit', 'OnTick'];
65
+ keywords.forEach(keyword => {
66
+ const regex = new RegExp(`\\b${keyword}\\b`, 'g');
67
+ highlighted = highlighted.replace(regex, `<span class="keyword">${keyword}</span>`);
68
+ });
69
+
70
+ // Highlight functions
71
+ const functions = ['iMA', 'trade.Buy', 'trade.Sell', 'NormalizeDouble', 'SymbolInfoDouble'];
72
+ functions.forEach(func => {
73
+ const regex = new RegExp(`\\b${func}\\b`, 'g');
74
+ highlighted = highlighted.replace(regex, `<span
style.css CHANGED
@@ -1,28 +1,107 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', sans-serif;
5
+ transition: background-color 0.3s, color 0.3s;
6
+ }
7
+
8
+ pre, code {
9
+ font-family: 'Fira Code', monospace;
10
+ }
11
+
12
+ /* Dark mode transition */
13
+ .dark pre, .dark code {
14
+ background-color: #1a202c;
15
+ }
16
+
17
+ /* Syntax highlighting for MQL5 code */
18
+ .language-mql5 .keyword {
19
+ color: #f472b6; /* Pink for keywords */
20
+ }
21
+
22
+ .language-mql5 .function {
23
+ color: #60a5fa; /* Blue for functions */
24
+ }
25
+
26
+ .language-mql5 .comment {
27
+ color: #6b7280; /* Gray for comments */
28
+ font-style: italic;
29
+ }
30
+
31
+ .language-mql5 .string {
32
+ color: #34d399; /* Green for strings */
33
+ }
34
+
35
+ .language-mql5 .number {
36
+ color: #fbbf24; /* Yellow for numbers */
37
+ }
38
+
39
+ /* Custom scrollbar */
40
+ ::-webkit-scrollbar {
41
+ width: 8px;
42
+ height: 8px;
43
+ }
44
+
45
+ ::-webkit-scrollbar-track {
46
+ background: #f1f1f1;
47
+ border-radius: 4px;
48
+ }
49
+
50
+ ::-webkit-scrollbar-thumb {
51
+ background: #c1c1c1;
52
+ border-radius: 4px;
53
  }
54
 
55
+ ::-webkit-scrollbar-thumb:hover {
56
+ background: #a8a8a8;
 
57
  }
58
 
59
+ .dark ::-webkit-scrollbar-track {
60
+ background: #2d3748;
 
 
 
61
  }
62
 
63
+ .dark ::-webkit-scrollbar-thumb {
64
+ background: #4a5568;
 
 
 
 
65
  }
66
 
67
+ .dark ::-webkit-scrollbar-thumb:hover {
68
+ background: #718096;
69
  }
70
+
71
+ /* Animation for buttons */
72
+ button {
73
+ transition: all 0.2s ease-in-out;
74
+ }
75
+
76
+ /* Tooltip styles */
77
+ [data-tooltip] {
78
+ position: relative;
79
+ cursor: pointer;
80
+ }
81
+
82
+ [data-tooltip]:hover::after {
83
+ content: attr(data-tooltip);
84
+ position: absolute;
85
+ bottom: 100%;
86
+ left: 50%;
87
+ transform: translateX(-50%);
88
+ background-color: #333;
89
+ color: #fff;
90
+ padding: 4px 8px;
91
+ border-radius: 4px;
92
+ font-size: 12px;
93
+ white-space: nowrap;
94
+ z-index: 10;
95
+ }
96
+
97
+ /* Responsive adjustments */
98
+ @media (max-width: 768px) {
99
+ .editor-container {
100
+ flex-direction: column;
101
+ }
102
+
103
+ .sidebar {
104
+ width: 100%;
105
+ margin-bottom: 1rem;
106
+ }
107
+ }