MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading and Strategy Testing Forum

Subscribe to signal
Joker EA Conservative style
36.15%, 13 636.32 USD
Using WinInet in MQL5.  Part 2:  POST Requests and Files Using WinInet in MQL5. Part 2: POST Requests and Files eKeyboardTrader Expert Advisor
eKeyboardTrader
Author: Integer
Screenshot
EURUSD, H4
Demo
Brain Impulse MultiBrain Impulse Multi Try product
Brain Impulse Multi
Author: achidayat

// Discussion of article "Step-by-Step Guide to Writing an Expert Advisor in MQL5 for Beginners"

To add comments, please log in or register
statarb
27
statarb 2012.04.29 15:55

Why when tighten the S/L to 5 (supposed to be 5 pips)

I have the following

 

Attached files
capture.png (7.18 KB)
Rosh
Admin
4505
Rosh 2012.05.02 10:39
statarb:

Why when tighten the S/L to 5 (supposed to be 5 pips)

I have the following

 

You should check Stop Levels (SYMBOL_TRADE_STOPS_LEVEL) for a symbol before sending of trade request. The SL/TP mustn't be closer than this distance to current price to close. The sample to get this property:

int StopLevel_Distance=(int)SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL);
double SL=... // get new SL by calculation
//--- check current calculated Stop Loss level
if(SL>SymbolInfoDouble(_Symbol,SYMBOL_ASK)-StopLevel_Distance*_Point) 
   SL=SymbolInfoDouble(_Symbol,SYMBOL_ASK)-StopLevel_Distance*_Point;
//... modify SL for position
locan.BBS
51
locan.BBS 2012.06.21 16:37

Thanks, but neither my SL nor my TP are being carried out. In the compiler "Terminal" they are listed as "0.00" or "0.0"  Anyway it's impossible to give a general stoploss for all orders. And I haven't been successful yet in changing the parameter values from "outside", i.e. without changing the code in the editor.

Otherwise it's working great! And the comments are a great help!

Thanks again,

locan BBS

.locan.BBS:


mistrytrader
4
mistrytrader 2012.06.25 16:49

Hi Olowsam,

Thanks for this step-bystep guide. I have a few question, which I hope you'll be able to help me with.

        I have followed your instruction to the letter, but have failed to reach the desired result. First of all, I am working with the latest version of Meta Trader 5.00, Build 6.55 (6th June 2012).  I have noted several differences, the 1st being the MQL5 wizard template has extra options, then what you show in your notes. Any way, I have ensured the program is exactly as you have described. I have compiled it. No problems. Zero errors. I have managed to insert all the 5 debug break points as suggested in your notes in the OnTick subroutine. Click the Green Run button & NOTHING happens. The program execution does not get to this point. Why? What's happening? If I insert the debug breakpoints @ the start of OnInit sub, @ say, adzHandle=iADX9Null,0,ADX_Period) line, then this is OK. The debug STEP tabs, light up & I can single step this control all the way to the end of the OnInit sub. However, after that, again nothing. In short, I cannot reach the OnTick sub. What's happening & why? Is this a known bug in the operation of the Meta Trader system? How can I resolve this issue & move on?

I hope the above explains the problem I've had, & hope that you can see what's going on & that you will be able to assist.

Thanks.

Best Regards

Kishor 

mycall_14
3
mycall_14 2012.07.27 07:31

Hey Great Article,

Typed all the code out as i went along and didnt get any compile errors at the end so must of been well explained. A good excersise for first time using the metatrader5/mql5 system.

Might need to do some optimisation to make the graph go in an upward direction thou :D

All the best, and thanks!!

Mike

polymath
177
polymath 2012.08.25 10:23

Hi, 

I really liked the coding style of this article,  very easy to read and follow.  I just have one request if you don't mind, can you also give an example of how to implement trailing stops with this sample?

Thank you very much! 

Andrew Kreimer
440
pitaking 2012.10.08 10:46
Thank you very much for a wonderful guide!
M Oldemiro Fernandes
17
oldemiro77 2012.11.18 23:47

thank you for this article.

I felt lost when I start looking the MQL5 examples... after looking at your article, everithing is much easier to understand.

Mauro Bracuti
26
Almaro 2012.11.28 16:26

Ottima spiegazione :-)  Grazie :-)

Excellent article Tank You :-)

 

Hamed Tabasi
14
hamed_adore 2013.01.13 13:07

Great Article,

It helps me to save more than 3 months, Thank you, I am going to your next related article (OOP)

hoping to see money marking expert and sharing with you, I looking forward to such article,

Thank you again, 

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