hi all, is there something in MQL5 that is similar to excel vba macro for this: instead of: Cells.Activate Cells.Copy Cells.PasteSpecial xlPasteValues Cells.Delete to keep the code tidier: With Cells .Activate .Copy .PasteSpecial xlPasteValues .Delete End With in MQL5, how can i make the code tidier like above? MqlTradeRequest myrequest; myrequest.type = ORDER_TYPE_BUY; myrequest.action = TRADE_ACTION_DEAL; myrequest.tp = 0; myrequest.sl = 0; how do i 'group' the myrequest with 'with' and 'endwith' statement like in vba excel? many thanks!
- Place new buy or sell order in mql5?
- Generator of filter's indicator for MT4
- copy from mt5 optimisation results to excel sheet
It is extremely difficult trying to decipher your code example when it is all just one continuous line.
Please insert your code samples properly with the CODE button (Alt-S).
Regarding "with ... end with", I don't know of any such equivalent syntax in MQL nor C/C++ on which MQL is based.
antaeusguy:
hi all, is there something in MQL5 that is similar to excel vba macro for this: instead of: Cells.Activate Cells.Copy Cells.PasteSpecial xlPasteValues Cells.Delete to keep the code tidier: With Cells .Activate .Copy .PasteSpecial xlPasteValues .Delete End With in MQL5, how can i make the code tidier like above? MqlTradeRequest myrequest; myrequest.type = ORDER_TYPE_BUY; myrequest.action = TRADE_ACTION_DEAL; myrequest.tp = 0; myrequest.sl = 0; how do i 'group' the myrequest with 'with' and 'endwith' statement like in vba excel? many thanks!
hi all, is there something in MQL5 that is similar to excel vba macro for this: instead of: Cells.Activate Cells.Copy Cells.PasteSpecial xlPasteValues Cells.Delete to keep the code tidier: With Cells .Activate .Copy .PasteSpecial xlPasteValues .Delete End With in MQL5, how can i make the code tidier like above? MqlTradeRequest myrequest; myrequest.type = ORDER_TYPE_BUY; myrequest.action = TRADE_ACTION_DEAL; myrequest.tp = 0; myrequest.sl = 0; how do i 'group' the myrequest with 'with' and 'endwith' statement like in vba excel? many thanks!
I suppose you can implement this yourself, like the foreach loops, which do not exist in MQL5 either: https://www.mql5.com/en/articles/4332

LifeHack for traders: Blending ForEach with defines (#define)
- www.mql5.com
The article is an intermediate step for those who still writes in MQL4 and has no desire to switch to MQL5. We continue to search for opportunities to write code in MQL4 style. This time, we will look into the macro substitution of the #define preprocessor.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register