Discussion of article "How to Create Your Own Trailing Stop" - page 4

 
Alex_Pushkin:

my_first_ea_sartrailing.mq5(26.61 KB


when compiling it gives five errors, I tried the downloaded one, and compiled it according to the instructions.....

at first I was happy that there is this article, now I'm sad that I can't use it, maybe I didn't understand something?

or I'm doing it wrong..... hint please! to a beginner)


Show what errors, screenshot, what is there in the basement of the meta-editor.

 

other screenshots of errors in the files from below, so that the forum is not cluttered! tried in 5MT from another broker, gives the same errors!

Files:
 
Alex_Pushkin:

other screenshots of errors in the files at the bottom, so as not to clutter the forum! tried in 5MT from another broker, gives the same errors!


Download the file Sample_TrailingStop.mqh and put it in Include

 
Yes, thank you! It's working!
 

Great article! Thanks!!!

When compiling the Sample_TrailingStop.mqh head file, three warnings are generated:

return value of'OrderSend' should be checked Sample_TrailingStop.mqh 170 31
return value of 'OrderSend' should be checked Sample_TrailingStop.mqh 198 31
possible use of uninitialised variable 'tm' Sample_TrailingStop.mqh 209 21
0 error(s), 3 warning(s), compile time: 245 msec 1 4

The first two - it is clear, we need to provide verification, we know how to do it.

But how to fix the third one?

 
natyog:

Great article! Thanks!!!

When compiling the Sample_TrailingStop.mqh head file, three warnings are generated:

return value of 'OrderSend' should be checked Sample_TrailingStop.mqh 170 31
return value of 'OrderSend' should be checked Sample_TrailingStop.mqh 198 31
possible use of uninitialised variable 'tm' Sample_TrailingStop.mqh 209 21
0 error(s), 3 warning(s), compile time: 245 msec 1 4

The first two - it is clear, we need to provide verification, we know how to do it.

But how to eliminate the third one?


Where the tm array is declared, assign a value to the null element:

datetime tm[1]; // было

tm[0]=0; // добавить

 
thank you!
 

alas, but testing my_first_ea_sartrailing.mq5 gives:

2017.08.25 10:43:38.890 2016.01.21 12:00:00 failed instant sell 0.10 EURUSD at 1.08900 sl: 1.09200 tp: 1.07900 [Invalid request]
2017.08.25 10:43:38.891 2016.01.21 12:00:00 Alert: Sell order setup request failed - error code:4756

No request to set an order is executed! Why?

 
natyog:

alas, but testing my_first_ea_sartrailing.mq5 gives:

2017.08.25 10:43:38.890 2016.01.21 12:00:00 failed instant sell 0.10 EURUSD at 1.08900 sl: 1.09200 tp: 1.07900 [Invalid request]
2017.08.25 10:43:38.891 2016.01.21 12:00:00 Alert: Sell order setup request failed - error code:4756

No request to set an order is executed! Why?


And how do you open a position?

 
Dmitry Fedoseev:

How do you open a position?


Oh, yeah! Question to question, that's wise!

the position is opened by your Expert Advisor my_first_ea_sartrailing.mq5