Could anyone help with the idea of MQL4 to MQL5 conversion?

2 Views
Zain Jaja
Answered 6 months, 2 weeks ago
<p>This might give you answer you need</p><p><span class="fr-video fr-deletable fr-fvc fr-dvb fr-draggable" contenteditable="false" draggable="true"><iframe width="640" height="360" src="https://www.youtube.com/embed/CLZxjWxfwb8?autoplay=1&amp;mute=1&amp;wmode=opaque&amp;rel=0" frameborder="0" allowfullscreen="" class="fr-draggable"></iframe></span><br></p>
1 View
Clifford Zimmerman
Answered 1 week, 3 days ago
<p id="isPasted">Converting MQL4 code to MQL5 is not a simple copy-and-paste process; it requires significant code refactoring due to fundamental differences in the languages and platform architectures. MQL5 is an evolution of MQL4, based on the C++ paradigm, offering more advanced features and a different execution model.&nbsp;</p><p><strong>Key Differences to Consider</strong></p><p>Feature&nbsp;MQL4MQL5</p><table data-animation-nesting="" data-processed="true" style="border: none; border-collapse: collapse; table-layout: auto; width: 632px; color: rgb(230, 232, 240); font-family: &quot;Google Sans&quot;, Roboto, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(31, 31, 31); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" id="isPasted"><tbody data-processed="true"><tr data-processed="true" data-sfc-cp=""></tr><tr data-processed="true" data-sfc-cp=""><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px 12px 0px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">File Extension</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">.mq4&nbsp;(source),&nbsp;.ex4&nbsp;(compiled)</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 0px 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">.mq5&nbsp;(source),&nbsp;.ex5&nbsp;(compiled)</td></tr><tr data-processed="true" data-sfc-cp=""><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px 12px 0px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Execution Model</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Order-based (each trade managed individually)</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 0px 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Position-based (multiple trades of the same instrument consolidated)</td></tr><tr data-processed="true" data-sfc-cp=""><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px 12px 0px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Core Functions</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">init(),&nbsp;start(),&nbsp;deinit()</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 0px 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">OnInit(),&nbsp;OnTick(),&nbsp;OnDeinit(),&nbsp;OnTrade(),&nbsp;OnTradeTransaction(), etc.</td></tr><tr data-processed="true" data-sfc-cp=""><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px 12px 0px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Order Management</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Separate functions:&nbsp;OrderSend(),&nbsp;OrderModify(),&nbsp;OrderDelete()</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 0px 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Single&nbsp;OrderSend()&nbsp;function using&nbsp;MqlTradeRequest&nbsp;and&nbsp;MqlTradeResult&nbsp;structures</td></tr><tr data-processed="true" data-sfc-cp=""><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px 12px 0px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Indicators</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Direct functions (e.g.,&nbsp;iMA) return buffer values</td><td colspan="undefined" data-processed="true" data-sfc-cp="" style="border-bottom: 0.8px solid rgb(66, 70, 84); min-width: 4em; vertical-align: top; color: rgb(230, 232, 240); padding: 12px 0px 12px 10px; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 14px; line-height: 18px; font-weight: 400;">Use indicator handles (e.g.,&nbsp;iMA&nbsp;returns a handle) and require separate data retrieval steps …</td></tr></tbody></table>