about developing mt4 expert advisor

 

how do I develop mt4 ea?

1. buying condition?

2. selling condition?

3. buying closing condition?

4. selling closing condition?

5. stoploss condition?

6. takeprofit condition?

 

Forum on trading, automated trading systems and testing trading strategies

How to start with MetaTrader and forex, the beginning

Sergey Golubev, 2017.03.28 15:33

All lessons of Codersguru (for MT4) attached (just in case someone wants to learn mql4 for coding).
By the way, Codersguru is the member of our forum (his profile link) and he is the author of the famous MQL4 trading courses which he provided online on TSD forum.

We always should rememeber the people who were the first.

-------------

I attached pdf files of those codes to the post.

---------------



Files:
 

Forum on trading, automated trading systems and testing trading strategies

Something Interesting to Read December 2013

Sergey Golubev, 2013.12.25 08:14

Expert Advisor Programming for Metatrader 5: Creating Automated Trading Systems in the Mql5 Language (Paperback)




The first guide to programming in MQL5 is here! "Expert Advisor Programming for MetaTrader 5" is a practical guide to creating automated trading strategies in the MQL5 language. Take advantage of MetaTrader 5's new features and take your trading to the next level! You'll learn how to program expert advisors quickly and easily using a ready-made framework created by an experienced MQL programmer. This book will teach you the following concepts: Learn the basics of MQL5, including variables and data types, operators, functions, event handlers, and object-oriented programming. Place, modify and close market and pending orders. Calculate, verify and add stop loss and take profit prices to an open position. Add a flexible trailing stop and/or break even stop to your strategy. Manage your trade risk with money management. Use pending orders to scale in and out of positions. Use price, time and indicator data in your expert advisors. Control program execution by trading on new bar open, and add flexible trade timers to your strategies. Walk through the creation of several basic trading strategies from start to finish. Inform the user with dialog boxes, email alerts, mobile notifications and sounds. Draw trend lines, arrows and text labels on the chart. Read and write data to CSV files. Learn the basics of creating indicators, scripts and libraries in MetaEditor. Debug, test and optimize your trading strategy. And much more! Whether you're an experienced programmer moving from MQL4, or a novice just starting with MQL5, this book will give you the foundation to quickly program fully-featured and robust trading systems. All programs and source code files featured in the book are available for download at the book's official website at Expert Advisor Programming for MetaTrader - MQL4 and MQL5 book


 
Chang Suk Chung: how do I develop mt4 ea?

1. buying condition?

2. selling condition?

3. buying closing condition?

4. selling closing condition?

5. stoploss condition?

6. takeprofit condition?

You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
  1. Up to you
  2. Opposite of buy condition?
  3. Up to you
  4. Up to you
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
  5. Up to you, e.g. target based on previous prices, based on multiple of the SL, trailing SL.
 
Sergey Golubev:


thanks. 

I am reading the article right now. 

 
whroeder1:
You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
  1. Up to you
  2. Opposite of buy condition?
  3. Up to you
  4. Up to you
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
  5. Up to you, e.g. target based on previous prices, based on multiple of the SL, trailing SL.
 
whroeder1:
You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
  1. Up to you
  2. Opposite of buy condition?
  3. Up to you
  4. Up to you
    • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
    • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
  5. Up to you, e.g. target based on previous prices, based on multiple of the SL, trailing SL.


Thank you very much. 

I am studying C++.

 
See also
Newbie / Learning - # and ;
Newbie / Learning - # and ;
  • 2016.12.11
  • www.mql5.com
Hi all, I'm very new to MQL4 and have no C or C++ knowledge. I do know a fair bit of VBA. I have 2 questions on MQL4: 1) What is # used for...
Reason: