stop till next crossover. i hope to help me guys.
If you want someone to help you, you will have to show your code, so that it can be analysed to find out what is wrong with it.
Without your source code, it is impossible to "guess" what the problem is!
double MAfastCur = ..., MAfastPre = ...; double MAslowCur = ..., MAslowPre = ...; bool wasAbove = MAfastPre > MAslowPre, isAbove = MAfastCur > MAslowCur; /* bool isCrossed = isAbove != wasAbove; if(isCrossed) ... // looking for a signal. */ static bool isCrossed = false; bool wasCrossed = isCrossed; isCrossed = isAbove != wasAbove; if(isCrossed != wasCrossed) ... // Look for a change in signal.Alternatively you can only look for a signal at the start of a new bar.
New candle - MQL4 and MetaTrader 4 - MQL4 programming forum
If you want someone to help you, you will have to show your code, so that it can be analysed to find out what is wrong with it.
Without your source code, it is impossible to "guess" what the problem is!
i put it :3
You are looking at a signal, thus you open again. Look for a change in signal.Alternatively you can only look for a signal at the start of a new bar.
New candle - MQL4 and MetaTrader 4 - MQL4 programming forum
i build my code with expert builder i am not that good at programming but i have a little knowledge i put my code if you can see it plz
I would recommend you to search in the Codebase for an EA that trades with the signals of the indicator Alligator!
Why do you want to invent the wheel while your neighbour already give it away for free?
I would recommend you to search in the Codebase for an EA that trades with the signals of the indicator Alligator!
Why do you want to invent the wheel while your neighbour already give it away for free?
i would not to invent it but i search for it and i don't find it now i will search thanks
-
Since you haven't learned MQL4/5, therefor there is no common language
for us to communicate.
If we tell you what you need, you can't code it.
If we give you the code, you don't know how to integrate it into yours.
We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own. -
EA builder makes bad code counting up while closing multiple orders.
EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time. New candle - MQL4 forum
EA builder makes bad code, not adjusting for 4/5 digit brokers, TP/SL and slippage.
EA builder makes bad code, not adjusting for ECN brokers. (pre-Build 500)
EA builder makes bad code, not checking return codes.
EATree uses objects on chart to save values - not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)
EA builder, fxDreema, EATree, FxPro Quant, MQL5 Wizard, etc. are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned to the language up front, and then just wrote it.
-
Since you haven't learned MQL4/5, therefor there is no common language
for us to communicate.
If we tell you what you need, you can't code it.
If we give you the code, you don't know how to integrate it into yours.
We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own. -
EA builder makes bad code counting up while closing multiple orders.
EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time. New candle - MQL4 forum
EA builder makes bad code, not adjusting for 4/5 digit brokers, TP/SL and slippage.
EA builder makes bad code, not adjusting for ECN brokers. (pre-Build 500)
EA builder makes bad code, not checking return codes.
EATree uses objects on chart to save values - not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)
thanks a lot I appreciate so i will learn to go by myself from the begging, i want to ask you what is int start() do and void OnTick() can i use only OnTick()?
Sorry, but the code you posted was NOT coded by you, but instead generated with a very well know Code Generator / Builder that generates very bad old style code with many bugs.
So I have to ask, how to you expect to understand our answers to you, like the one given by @whroeder1 in a previous post, which is mostly in code, if you don't know how to code yourself?
No matter what answers or explanations we give you, they will not be understood. In fact, all of your "generated" code needs to be thrown away and a completely new, properly written "human" version needs to be coded from scratch.
EDIT: Oops! Looks like @whroeder1 posted his answer (and you replied) while I was typing!
This is how I first learned to code in MQL4, so it might be a good place for you to start:
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.
Forum on trading, automated trading systems and testing trading strategies
Sergey Golubev, 2017.09.16 05:48
Expert Advisor Programming for MetaTrader 5
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i write a code in meta trader 4 it open orders for buy and close , i have one problem that when any order hit Take Profit or stop loss it open another order auto what i need that when order finish
stop till next crossover.
i hope to help me guys.