Just use if...else statement
Can you describe more? Mohamad Zulhairi Baba
Happy New Year everybody !!
Hi experts,I have a question about how to code following trading condition.
rule
1.Fast moving average cross up slow moving average
2.If RSI >70 within 50 bars after crossing then open long
It mean 50 bars after cross up ,just wait for RSI>70 but won't be under first condition .
I think that loop (for,while) must be used but I confuse in this case.
thank very much
Before you start trying to re-event the wheel - there is practically nothing that does not exist for mt4/5. Start searching (top right) or googleing!
The best way to learn coding is quite simple: Just take an existing EA or indicator and change it according to your goal.
Thank Carl Schreiber
1 more question.
How to set any variable to index like timeseries? or return value of variable by shift.
such as
If(condition1 and condition2 and condition3 ........)
x=1;
when time passes,how we get value of x ?
moonsky: Hi experts,I have a question about how to code following trading condition.
Obviously are are still very much a beginner at any type of coding, so any explanation we give you here is probably not going to be easily understood.
So, I suggest you first learn the basics and the following book can help you learn the necessary skills:
Forum on trading, automated trading systems and testing trading strategies
Sergey Golubev, 2017.09.16 05:40
Expert Advisor Programming for MetaTrader 4
This book will teach you the following concepts:
- The basic of the MLQ4 language, including variables and data types, operations, conditional and loop operators, functions, classes and objects, event handlers and more.
- Place, modify and close market and pending orders.
- Add a stop loss and/or take profit price to an individual order, or to multiple orders.
- Close orders individually or by order type.
- Get a total of all currently opened orders.
- Work with OHLC bar data and locate basic candlestick patterns.
- Find the highest high and lowest low of recent bars.
- Work with MetaTrader’s built-in indicators, as well as custom indicators.
- Add a trailing stop or break even stop feature to an expert advisor.
- Use money management and lot size verification techniques.
- Add a flexible trading timer to an expert advisor.
- Construct several types of trading systems, including trend, counter-trend and breakout systems.
- Add alert, emails, sounds and other notifications.
- Add and manipulate chart objects.
- Read and write to CSV files.
- Construct basic indicators, scripts and libraries.
- Learn how to effective debug your programs, and use the Strategy Tester to test your strategies.
All of the source code in this book is available for download, including an expert advisor framework that allows you to build robust and fully-featured expert advisors with minimal effort.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Happy New Year everybody !!
Hi experts,I have a question about how to code following trading condition.
rule
1.Fast moving average cross up slow moving average
2.If RSI >70 within 50 bars after crossing then open long
It mean 50 bars after cross up ,just wait for RSI>70 but won't be under first condition .
I think that loop (for,while) must be used but I confuse in this case.
thank very much