Download MetaTrader 5
To add comments, please log in or register
Use MQL5 Cloud Network. It is secure!
keltrem
191
keltrem 2013.09.06 11:19 

New to the world of Metatrader and do not have a good understanding of the power of capabilities of MQL.

Is MQL capable of calculating a value using a semi complex mathematical formula or an equation that needs to calculate variables?


Thanks for your advice

Alain Verleyen
Moderator
28596
Alain Verleyen 2013.09.06 11:51  
keltrem:

New to the world of Metatrader and do not have a good understanding of the power of capabilities of MQL.

Is MQL capable of calculating a value using a semi complex mathematical formula or an equation that needs to calculate variables?


Thanks for your advice

Probably, but you need a math library for that. See if this one https://www.mql5.com/en/code/1146 meets your needs.
ALGLIB - Numerical Analysis Library
ALGLIB - Numerical Analysis Library
  • votes: 33
  • 2012.10.12
  • Сергей Бочканов
  • www.mql5.com
ALGLIB math function library (v. 3.5.0) ported to MQL5.
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2013.09.06 11:52  
keltrem:

New to the world of Metatrader and do not have a good understanding of the power of capabilities of MQL.

Is MQL capable of calculating a value using a semi complex mathematical formula or an equation that needs to calculate variables?

Can you be a little more specific and absolute ?  linear equations are complex to some people but not others . . .  there are some Maths functions
keltrem
191
keltrem 2013.09.06 13:12  
RaptorUk .Thanks for directing me to the maths functions. It appears I will be able to have what I want coded. As it is a maths formula would I be better to specify that a coder has a maths background?
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2013.09.06 14:01  
keltrem:
RaptorUk .Thanks for directing me to the maths functions. It appears I will be able to have what I want coded. As it is a maths formula would I be better to specify that a coder has a maths background?
If a coder is selling his/her services you should expect them to be familiar with the majority of available standard functions . . .  if you give a little more detail about what it is you are trying to do we might be able to give an indication of how easy or hard it is to do with mql5.
keltrem
191
keltrem 2013.09.07 01:56  

What I want to be able to calculate is when a MA and WMA will be exactly the same price during the current bar ie the precursor to a cross. My maths is a little rusty but I believe the equation looks like this on MA40 and WMA5


MA = (CP1,39 + P)/40

WMA = ((CP4*1)+(CP3*2)+(CP2*3)+(CP1*4)+(P*5))/15

Find

MA =WMA

Value to be determined is P

CP are close prices

Is this within the scope of MQL's capabilities and how would this be best coded?

Thanks,


Noel

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants - Documentation on MQL5
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2013.09.07 09:06  
keltrem:

What I want to be able to calculate is when a MA and WMA will be exactly the same price during the current bar ie the precursor to a cross. My maths is a little rusty but I believe the equation looks like this on MA40 and WMA5

This is certainly pretty simple to do for someone that has some experience with mql5,  the issue I see is that using a still forming bar,  bar 0, you can have the MAs cross and uncross several times giving you signals both ways.  If that is what you want it can be done with mql5. 
keltrem
191
keltrem 2013.09.07 09:25  

Yes i am aware of the MAs propensity to cross and uncross, the EA deals with that. I was more interested to know is a maths equation the best way to determine the price that MA = WMA in the current bar or is there another method of calculating the same thing?

Additionally is it possible to form this equation in MQL where average periods can be modified by a parameter? For example go from MA40 to MA30

Alain Verleyen
Moderator
28596
Alain Verleyen 2013.09.07 09:33  
keltrem:

Yes i am aware of the MAs propensity to cross and uncross, the EA deals with that. I was more interested to know is a maths equation the best way to determine the price that MA = WMA in the current bar or is there another method of calculating the same thing?

Additionally is it possible to form this equation in MQL where average periods can be modified by a parameter? For example go from MA40 to MA30

You already get the response several times. Yes it's possible with mql5. But you have to provide some efforts to learn how to do it, I doubt someone will give you the code you asked for. If you don't want to code it yourself you can also try the Job service or search the codebase for existing code.
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2013.09.07 12:59  
keltrem:

Yes i am aware of the MAs propensity to cross and uncross, the EA deals with that. I was more interested to know is a maths equation the best way to determine the price that MA = WMA in the current bar or is there another method of calculating the same thing?

Additionally is it possible to form this equation in MQL where average periods can be modified by a parameter? For example go from MA40 to MA30

Yes,  iMA()
keltrem
191
keltrem 2013.09.08 01:15  
Many thanks for this information RaptorUK, it make the EA spec that much easier
/
To add comments, please log in or register