Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
I am trying to modify an indicator to place trades. Beside inserting the Order commands, what do I need to change to let MT4 know it is an EA? My program simply does not load/respond when I try to load it as an EA.
Also, where should I look to find this answer without bothering you experienced programmers?
i have indicator(3ma cross with signal)i need to change it to ea , can i copy ind init() to expert init() and ind start() to expert start() and then put sell and buy function when the arrow give me signal??
In another forum I frequent that is for customers of a particular EA, one customer was complaining about the fact that the EA developer hadn't yet fixed the 5th decimal / fractional pricing issue for their EA.
The developer claimed several months ago that this issue required special scripting to solve. Now, 4 months later, I basically said it was ridiculous that it had not been fixed yet - and claimed that it only required a few lines of code to redefine "Point" similar to the method described here.
So here comes the question. The developer still insists this problem is super complicated and requires special script programming to fix it. Here is the explanation from the developer:
So my question is this: Have any of you experienced programmers encountered this complicated scripting requirement or issues with the MT4 Platform's value of "Point"?
Even if you assume "Point" is limited to 4 decimals, then that would mean you only have to worry about pairs with Point = 0.001 ----which still only takes a line or two of code.
Or, you could use "Digits" instead of "Point" - which still uses only a few lines of code.
Or you could just use a boolean variable like "UseFractionalPips = true;" to redefine "Point".
I really feel like the developer is either making the problem more complicated than it is (or perhaps other motives). I simply have never read or heard of this issue with "Point" being limited to only 4 decimals - and even if it is you could use "Digits" or other methods to redefine point without some special scripting.
I'm only been programming in MT4 for 18 months, so I thought I would defer to some more experienced programmers as to how complicated the "fix" is for dealing with fractional pip pricing in MT4.
Any thoughts?
Thanks in advance for your help,
-B
Six-Digit Forex Quotes and MetaTrader Expert Advisors
Many Forex brokers have started to offer 6 digit Forex quotes to via the MetaTrader 4 terminal recently. It has a lot of benefits for the scalping traders and opens up many new trading possibilities for others. But there seems to be a problem with almost all expert advisors that are applied to the MetaTrader 4 platform, which uses 6 digit Forex quotes instead of the more conventional 5 digit format. As the most expert advisors use the "Point" variable for pips to denominate stop-loss and take-profit, there are two major problems with the 6 digit quotes. First, both stop-loss and take-profit values have very strong chances to come to close to the current pair’s price and MT4 will generate an Error 130, if they are to close. Second, the whole strategy embedded into the given EA will stop working properly because all the profits and losses will probably be divided by 10.
Let’s look at the following example. With a 5 digit quote EUR/USD rate is 1.5703 and one Point in MetaTrader 4 is 0.0001 — a conventional pip for EUR/USD pair. Our expert advisor buys EUR/USD, setting stop-loss at 20 pips — 1.5683, and take profit at 40 pips — 1.5743. Everything goes fine and we win 40 pips when the rate reaches 1.5743. But for a 6 digit quote things are completely different. E.g. the rate above might have been 1.57032 and one Point in your MT4 would have been 0.00001 — ten times less than the conventional pip for EUR/USD. The same expert advisor would have set the stop-loss at 1.57012 and take-profit at 1.57072. Not only 99% of the brokers wouldn’t allow such a close stop-loss and take-profit setting, but if allowed this position wouldn’t be very rational and of course it wouldn’t be according to the initial strategy rules.
So how to correct this problem without completely rewriting the expert advisor and, of course, without changing a broker (to one with the 5 digit quotes)? First, I’d like to tell you that all MetaTrader expert advisors that are featured on my site have been already modified to work with both 5 and 6 digit quotes. Second, here is the way to make any EA to work properly with 6 digit quotes:
1. Open the .mq4 of the expert advisor that you want to change in MQL Editor.
2. Add a new global variable declaration (it should be in the beginning of the code, along with other variable declarations):
double Poin;
3. Add the following code to the init() function of the EA. This function is usually present in all EAs (it contains various initialization routines), but if it’s not there, create it and include this code:
//Checking for unconventional Point digits number
if (Point == 0.00001) Poin = 0.0001; //6 digits
else if (Point == 0.001) Poin = 0.01; //3 digits (for Yen based pairs)
else Poin = Point; //Normal
4. Replace all further occurrences of "Point„ in the code with “Poin„ (except those in the init() function). This will change the system MT4 variable “Point„ to our declared variable “Poin", which now contains the standard 5 digit pip value.
5. That’s all. Compile it and you are ready to run it on the 6 digit quotes in MetaTrader. Of course, it will still work with standard 5 digit quotes too.
Anybody help me? in the mt4 plotform the charts are given in fixed time frames i.e. 1min, 5min, 15min, 30min, 1hour, 4hour, day ,etc. I want to see the charts4min,6min, 10min, 20min, 25min, 35min etc time frames live. How to change the time frames to as per our reqiured time frames? I am not a programmer. Hence, kindly explain it in detail how to do it. If there is any code etc available, please post it.
Thanks in advace.
Is it possible to write mql4 code that does floating point arithmetic correctly?
I am a retired programmer with over 40 years of experience. I have thus far been unsuccessful in making an indicator I have written do correct calculations, in spit of using CompareDoubles and NormalizeDouble in every instance that they are necessary.
I've written a Python script (using the decimal library) to duplicate the work of my indicator and the errors of mql4 are clear to see when I compare the output of the two. There are not many discrepancies but there are some and this should not happen.
Six-Digit Forex Quotes and MetaTrader Expert Advisors
Many Forex brokers have started to offer 6 digit Forex quotes to via the MetaTrader 4 terminal recently. It has a lot of benefits for the scalping traders and opens up many new trading possibilities for others. But there seems to be a problem with almost all expert advisors that are applied to the MetaTrader 4 platform, which uses 6 digit Forex quotes instead of the more conventional 5 digit format. As the most expert advisors use the "Point" variable for pips to denominate stop-loss and take-profit, there are two major problems with the 6 digit quotes. First, both stop-loss and take-profit values have very strong chances to come to close to the current pair’s price and MT4 will generate an Error 130, if they are to close. Second, the whole strategy embedded into the given EA will stop working properly because all the profits and losses will probably be divided by 10.
Let’s look at the following example. With a 5 digit quote EUR/USD rate is 1.5703 and one Point in MetaTrader 4 is 0.0001 — a conventional pip for EUR/USD pair. Our expert advisor buys EUR/USD, setting stop-loss at 20 pips — 1.5683, and take profit at 40 pips — 1.5743. Everything goes fine and we win 40 pips when the rate reaches 1.5743. But for a 6 digit quote things are completely different. E.g. the rate above might have been 1.57032 and one Point in your MT4 would have been 0.00001 — ten times less than the conventional pip for EUR/USD. The same expert advisor would have set the stop-loss at 1.57012 and take-profit at 1.57072. Not only 99% of the brokers wouldn’t allow such a close stop-loss and take-profit setting, but if allowed this position wouldn’t be very rational and of course it wouldn’t be according to the initial strategy rules.
So how to correct this problem without completely rewriting the expert advisor and, of course, without changing a broker (to one with the 5 digit quotes)? First, I’d like to tell you that all MetaTrader expert advisors that are featured on my site have been already modified to work with both 5 and 6 digit quotes. Second, here is the way to make any EA to work properly with 6 digit quotes:
1. Open the .mq4 of the expert advisor that you want to change in MQL Editor.
2. Add a new global variable declaration (it should be in the beginning of the code, along with other variable declarations):
double Poin;
3. Add the following code to the init() function of the EA. This function is usually present in all EAs (it contains various initialization routines), but if it’s not there, create it and include this code:
//Checking for unconventional Point digits number
if (Point == 0.00001) Poin = 0.0001; //6 digits
else if (Point == 0.001) Poin = 0.01; //3 digits (for Yen based pairs)
else Poin = Point; //Normal
4. Replace all further occurrences of "Point„ in the code with “Poin„ (except those in the init() function). This will change the system MT4 variable “Point„ to our declared variable “Poin", which now contains the standard 5 digit pip value.
5. That’s all. Compile it and you are ready to run it on the 6 digit quotes in MetaTrader. Of course, it will still work with standard 5 digit quotes too.
I guess this is something basic, just I do not know how to access it. Can someone tell me how to retrieve the Daily Open/Close from several days ago whether I am on a chart which is other than the Daily? Maybe provide sample code, it would be helpful.