Download MetaTrader 5
To add comments, please log in or register
Do you have a trading signal? Publish it in your blog as well!
Ikhwezilokusa Dlamini
167
Ikhwezilokusa Dlamini 2015.09.15 14:29 

Hello traders, 

I have just finished my EA but it has 11 warning. At first I thought it would be ok because when I back tested it on the Strategy tester it worked fine.
As soon as I went live the EA does work but because of the errors it opens more than 1 trade at a time. 

 

I would like it to open one and not to open another, till the current one is closed, if that makes sense. 

Please help thanks, FXMercury  

Marco vd Heijden
Moderator
4046
Marco vd Heijden 2015.09.15 16:55  

slowly talk into your microphone and say "Please Expert, only open one order at a time" and see if that works.

or post some of your code so we can actually help you. 

kerso4
203
kerso4 2015.09.15 16:57  
FXMercury249:

Hello traders, 

I have just finished my EA but it has 11 warning. At first I thought it would be ok because when I back tested it on the Strategy tester it worked fine.
As soon as I went live the EA does work but because of the errors it opens more than 1 trade at a time. 

 

I would like it to open one and not to open another, till the current one is closed, if that makes sense. 

Please help thanks, FXMercury  

I would do it with the function PositionsTotal() and a conditional. 

https://www.mql5.com/en/docs/trading/positionstotal

Documentation on MQL5: Trade Functions / PositionsTotal
Documentation on MQL5: Trade Functions / PositionsTotal
  • www.mql5.com
Trade Functions / PositionsTotal - Reference on algorithmic/automated trading language for MetaTrader 5
Pankaj D Costa
2715
Pankaj D Costa 2015.09.15 18:05  
Marco vd Heijden:

slowly talk into your microphone and say "Please Expert, only open one order at a time" and see if that works.

or post some of your code so we can actually help you. 

First time I thought you are joking, then read the question again and understand, your replied perfectly. Lol !!!
Sherif Hasan
7223
Sherif Hasan 2015.09.15 21:22  
Marco vd Heijden:

slowly talk into your microphone and say "Please Expert, only open one order at a time" and see if that works.

or post some of your code so we can actually help you. 

LOL... You have nice Humour Sense.... I cant stop my laugh. Sorry may be the member must be newbie...
Marco vd Heijden
Moderator
4046
Marco vd Heijden 2015.09.16 13:57  

thats not code only warnings.

it already sais what you need to do.

check the return value of orderselect.

 Returned value:

It returns true if the function succeeds, otherwise falses. To get the error information, one has to call the GetLastError() function.


bool result;//declare result

result=OrderSelect(.....//get value

if(result==1)
 {
  // Order Selected
 }

if(result==0)
 {
  // Orderselect Failed
 }

 simplistic representation to give you a hint.

Sherif Hasan
7223
Sherif Hasan 2015.09.16 17:15  
FXMercury249:

Sorry, Here are the attachments.. screenshots.

 1 - The 7 warnings

2 - first to problems

3 - next 2 problems

 4 - Final 3 warnings 

  


 

Replace the following code. wherever apply. which will remove 6 warnings return value of "OrderSelect" to be checked.

bool var1=OrderSelect(LongTicket, SELECT_BY_TICKET); 
instead of OrderSelect(LongTicket, SELECT_BY_TICKET);

for more 
OrderSelect(LongTicket, SELECT_BY_TICKET);
OrderSelect(ShortTicket, SELECT_BY_TICKET);

replace with 
bool var1=OrderSelect(LongTicket, SELECT_BY_TICKET); 
bool var2=OrderSelect(ShortTicket, SELECT_BY_TICKET); 
bool var3=OrderSelect(LongTicket, SELECT_BY_TICKET); 


Another warning. add the following statement below the line i specified below:

RealPoint=RealPoint(Symbol());
return(0);
}
Marco vd Heijden
Moderator
4046
Marco vd Heijden 2015.09.16 17:22  
SHERIFF Hassan:

Replace the following code. wherever apply. which will remove 6 warnings return value of "OrderSelect" to be checked.

yes but it will not actually check the return value.

trader77330
148
trader77330 2015.09.16 23:11  
kerso4:

I would do it with the function PositionsTotal() and a conditional. 

https://www.mql5.com/en/docs/trading/positionstotal

Exactly what I do (there's not many ways to do it, anyway) :)
jeanphi0034
9
jeanphi0034 2015.12.19 12:05  

Bonjour

 

Je pense que je peux parler francais

If you have a problem to read french language I can translate, no problem

 

Voila, je vous contacte car j'ai vu que vous aviez commenté un article de Michel du blog Michel attitude

a propos de l'indicateur de Bill William que je découvre et qui me semble pertinent

qu"en pensez vous ?

 

Sinon, j'essaie de me mettre a la programmation en langage MQL5 et plus précisemment j'essaie d'appliquer un EA que j'ai découvert sur le site, il s'agit de 

"STEP-BY-STEP GUIDE TO WRITING AN EXPERT ADVISOR IN MQL5 FOR BEGINNERS 9 June 2010"

 de: SAMUEL OLOWOYO

https://www.mql5.com/en/articles/100 

 

il ne fonctionne pas chez moi, j'aurais souhaité un peu d'aide ...

 

Jean Philippe 

Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
  • 2010.06.09
  • Samuel Olowoyo
  • www.mql5.com
The Expert Advisors programming in MQL5 is simple, and you can learn it easy. In this step by step guide, you will see the basic steps required in writing a simple Expert Advisor based on a developed trading strategy. The structure of an Expert Advisor, the use of built-in technical indicators and trading functions, the details of the Debug mode and use of the Strategy Tester are presented.
Alain Verleyen
Moderator
28550
Alain Verleyen 2015.12.19 12:43  

Please post in English only on this forum.

Nous avons un seul fil de discussion en français.

/ /12
To add comments, please log in or register