Libraries: MQL_Easy (For MT4)

Revo Trades
526
Revo Trades  
i have a bug that sometimes, when my ea sends a new order to server, it will open multiple orders until it reaches my maximum limit of allowed trades. And after doing research on the web, it is very common bug, but i have found almost 0 way to get around it or stop it from occuring. It rarely happens, but when it does it is a pita. Can you tell me that your execution code has same bug?
Dionisis Nikolopoulos
22552
Revo Trades:
i have a bug that sometimes, when my ea sends a new order to server, it will open multiple orders until it reaches my maximum limit of allowed trades. And after doing research on the web, it is very common bug, but i have found almost 0 way to get around it or stop it from occuring. It rarely happens, but when it does it is a pita. Can you tell me that your execution code has same bug?

I haven't faced an issue like yours. But if you provide your code maybe i can help you and also check if that issue exist on the MQL_Easy framework.

José Fortes
12
José Fortes  

Hello,


I run the example , but it doesn't stop in the chart window.

Can you help me?


Thanks.

Dionisis Nikolopoulos
22552
José Fortes:

Hello,


I run the example , but it doesn't stop in the chart window.

Can you help me?


Thanks.

Yes, of course.
I will need more information about your issue.
What do you mean by "it doesn't stop in the chart window" ? 
The script does the following:
1) open a trade
2) modify the sl and tp
3) modify again
4) and finally close that trade.

Which steps do you see happening and which you don't?
Also, check at the Experts tab if there is any error message.

Regards

José Fortes
12
José Fortes  
Dionisis Nikolopoulos:

Yes, of course.
I will need more information about your issue.
What do you mean by "it doesn't stop in the chart window" ? 
The script does the following:
1) open a trade
2) modify the sl and tp
3) modify again
4) and finally close that trade.

Which steps do you see happening and which you don't?
Also, check at the Experts tab if there is any error message.

Regards

Hello,

thanks for your reply.

What happens is that I don't have enough time to see what the program does.

It's too quick.

Thanks.

Dionisis Nikolopoulos
22552
José Fortes:

Hello,

thanks for your reply.

What happens is that I don't have enough time to see what the program does.

It's too quick.

Thanks.

Hi, 
If you open the script example into mql editor, you will see a function called sleep. Increase the parameter of that function from 2000 ms to 10000 ms and then you will have enough time to observe the changes. 10000 ms = 10 seconds

Regards
Dima Diall
61
Dima Diall  

Hello Dionisis,

I want to extend CPosition such that I can select a group of positions depending their direction (long vs short) as well as profit (positive vs negative). I was considering either creating my own enum for all 7 combinations or use your original GROUP_POSITIONS enum in addition to a boolean member in my subclass (e.g. bool in_profit) -- something like the excerpt below... any suggestion what the best approach might be?

enum GROUP_POSITIONS
{
   GROUP_POSITIONS_ALL            = -1,     
   GROUP_POSITIONS_BUYS           = 0,     
   GROUP_POSITIONS_SELLS          = 1      
};

class CPositionProfit : public CPosition
{
   protected:
     bool in_profit;

// ...
}

////////////////////////////////////////

enum GROUP_POSITIONS_PROFIT
{
   GROUP_POSITIONS_ALL            = -1,
   GROUP_POSITIONS_BUYS           = 0,
   GROUP_POSITIONS_SELLS          = 1,
   GROUP_POSITIONS_BUY_POS        = 2,
   GROUP_POSITIONS_SELL_POS       = 3,
   GROUP_POSITIONS_BUY_NEG        = 4,     
   GROUP_POSITIONS_SELL_NEG       = 5
};

class CPositionProfit : public CPosition
{
//...
}

Would you like me to send you a pull request with my new class(es) once I'm done? Btw, do you welcome or accept contributions that are more stylistic as opposed to functional to your own code base? 

Cheers,

DD

PS: I'm thinking I might need to override CPositionBase::ValidPosition() too, but not sure it would be possible.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
Dionisis Nikolopoulos
22552
ddiall:

Hello Dionisis,

I want to extend CPosition such that I can select a group of positions depending their direction (long vs short) as well as profit (positive vs negative). I was considering either creating my own enum for all 7 combinations or use your original GROUP_POSITIONS enum in addition to a boolean member in my subclass (e.g. bool in_profit) -- something like the excerpt below... any suggestion what the best approach might be?

Would you like me to send you a pull request with my new class(es) once I'm done? Btw, do you welcome or accept contributions that are more stylistic as opposed to functional to your own code base? 

Cheers,

DD

PS: I'm thinking I might need to override CPositionBase::ValidPosition() too, but not sure it would be possible.

Hi,

Of course, you are welcome to any contribution! Just one thing, we need to follow the same naming conventions style in order to keep it clean and beautiful. 
For example, the 'in_profit' property should be renamed like 'InProfit' as the whole library follows the same styling. 

Regards

Jeremy David Cottell
166
Jeremy David Cottell  

Hi,

This looks like a great library! I am still experimenting and getting familiar with it.

When I tried some simple tests in the MT4 strategy tester I keep getting error messages in the journal that the selected symbol doesn't exist.

Such as "EURUSD,M15: Message : The symbol EURUSD doesn't exist."

My work around hack is:


bool CUtilitiesBase::CheckSymbol(string symbolPar)
{
   if(IsTesting()){return true;}
......
}

Which seems to work fine.

Is this a bug? Or limitation?

Has anybody else had problems using this library with the mt4 tester?

Dionisis Nikolopoulos
22552
JezzAU:

Hi,

This looks like a great library! I am still experimenting and getting familiar with it.

When I tried some simple tests in the MT4 strategy tester I keep getting error messages in the journal that the selected symbol doesn't exist.

Such as "EURUSD,M15: Message : The symbol EURUSD doesn't exist."

My work around hack is:


Which seems to work fine.

Is this a bug? Or limitation?

Has anybody else had problems using this library with the mt4 tester?

Hi,
Thank you!

I verify that SymbolSelect has issue with the StrategyTester. The problem may occurs on the fact that the symbols of the strategy tester are the symbols on Market watch by default. 
So, i will make an update to the framework with following change:

bool CUtilitiesBase::CheckSymbol(string symbolPar)
{
   bool isSelected = SymbolInfoInteger(symbolPar,SYMBOL_SELECT);
   bool symbolCheck = (!isSelected) ? SymbolSelect(symbolPar,true) : true;
   if(!symbolCheck){
      this.Error.CreateErrorCustom("The symbol "+symbolPar+" doesn't exist.");
      return false;
   }
   return true; 
}

Regards