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.
Metatrader takes arguments for trigonometric functions in radians
You should do something like this :
PHP Code:
#define Pi 3.141592653589793238462643
MathCos(10.00*Pi/180.00);
Quote:
Originally Posted by graemenash
Hi,
I am currently coding up in indicator which uses the MathCos function in MQL.
The problem is that it seems to be returning an incorrect value.
For example,
PHP Code:
MathCos(10);
returns a value of -0.8391, while the TradeStation COSINE function, and the web-based cosine calculator at Basic Maths Functions both return a value of 0.9848.
Is this a known bug? My indicator can't be written unless this function works correctly so I hope there is a solution!
That picture from tradestation shows an interesting thing to us complaining at Metatrader problems : basically in tradestation if you are trying to simply apply a color to a current bar it is going to work OK in all the modes (histo, point, cross, ... all the styles tradestation knows) EXCEPT line style. If you try to change the color in a line style the color change is going to lag one bar and in order to make it properly source must be changed (in the case of that picture to something like this
PHP Code:
if Value1>Value1[1] then SetPlotColor[1](1,Green) else SetPlotColor[1](1,red);
meaning, you have to change the color of the PREVIOUS bar
this peace of code also means that you can not change the style from line style because then the color is going to FORECAST the change and thus it will make it a classical case of repainting indicator
so every coding language has its problems, and maybe we should simply find solutions in our environment (solutions are there, all we have to do is to find them out)
every coding language has its problems, and maybe we should simply find solutions in our environment (solutions are there, all we have to do is to find them out)
I want to close all trades if % gain is achieved on a weekly base.
So I need to know the accountbalance sundayevening 24.00 - no problem.
I need to know equity on sundayevening 24.00 - no problem.
But how do I store these? And how to let the ea read these values, for if there is a powerbreakdown the ea will have to start again and have to read the values from the stored place.
I know how to do this in VB, but how do I do this in mql?
I would be gratefull if someone can point that out.