Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1539
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
Is this the right thing to do?
Is this the right thing to do?
Thank you. It's complicated. I've made it simpler, just a couple of lines.
Thank you. It's complicated. I made it simpler, just a couple of lines.
interesting to see if
for(i=k; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if(OrderSymbol()==Symbol()) {
if(OrderMagicNumber()== Magic) {
{ if(OrderType()>1) continue;
if(OrderType()==OP_BUY || OrderType()==OP_SELL) total++;
}}}}
//---
// total=OrdersTotal();
if(total<1)
{
Hi all, I wanted to create my own function library because I often use the same functions in my robots. I've done everything right. I created the library, put it in the Libraries folder and plugged it in my indicator using #import
#import "andylib.ex4".
bool KeyPr (long l, string k);
string TestFunc ();
#import
Specified functions in the library with a description. But functions from the library are not called. I tried to put the dialog in the folder of indicators or even directly in the same folder with indicator, that connects to the dialog, without result. What may be the problem?
Hi all, I wanted to create my own function library because I often use the same functions in my robots. I've done everything right. I created the library, put it in the Libraries folder and plugged it in my indicator using #import
#import "andylib.ex4".
bool KeyPr (long l, string k);
string TestFunc ();
#import
Specified functions in the library with a description. But functions from the library are not called. I tried to put the dialog in the folder of indicators or even directly in the same folder with indicator, that connects to the dialog, without result. What may be the problem?
include
for(i=k; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if(OrderSymbol()==Symbol()) {
if(OrderMagicNumber()== Magic) {
{ if(OrderType()>1) continue;
if(OrderType()==OP_BUY || OrderType()==OP_SELL) total++;
}}}}
//---
// total=OrdersTotal();
if(total<1)
{
What you wrote can't work.
First you calculate "total++" and then you zero out and set "OrdersTotal()", i.e. all orders
Hi all, I wanted to create my own function library because I often use the same functions in my robots. I've done everything right. I created the library, put it in the Libraries folder and plugged it in my indicator using #import
#import "andylib.ex4".
bool KeyPr (long l, string k);
string TestFunc ();
#import
Specified functions in the library with a description. But functions from the library are not called. I tried to put the dialog in the folder of indicators or even directly in the same folder with indicator, that connects to the dialog, without result. What may be the problem?
Did you remember to write export after the function name in the library?
Better yet, don't make a library, but an .mqh file with functions, even without a class, and the compilation will take only those functions that are needed and are called from the EA/indicator.