How to code? - page 174

 

Point value Zero

wolfe:
double point =MarketInfo(Symbol(),MODE_DIGITS)*Point;

Comment("\nPoint = ",point);

Awesome, grateful. Thanks.

 
Saab59:
Awesome, grateful. Thanks.

Not sure if that actually works right or not, now that I think about it.

Does this return what you were looking for?

 

I think that is better:

Comment("\nPoint = ",DoubleToStr(Point,Digits));
 
wolfe:
Not sure if that actually works right or not, now that I think about it. Does this return what you were looking for?

Yes, it working, thanks. In the MetaEditor if you click F1 on MarketInfo() it list a couple of sample code for example :

double bid = MarketInfo("EURUSD",MODE_BID);

double ask = MarketInfo("EURUSD",MODE_ASK);

double point = MarketInfo("EURUSD",MODE_POINT);

int digits = MarketInfo("EURUSD",MODE_DIGITS);

int spread = MarketInfo("EURUSD",MODE_SPREAD);

The point example is retuning zero when displayed in my example, therefore my curiosity. Clicking F1 on Point does not indicate anything about decimal values when outputting the value.

Looking at Roger09 example, I am not sure why one have to convert it to a string, but it seems to work. So the question is, why in the above example does the Comment statement work for bid, ask etc which are of double type too but not for point when I tried to ouput them.

Roger thanks for your suggestion.

 
Looking at Roger09 example, I am not sure why one have to convert it to a string, but it seems to work.

Comment() and Print() show you only 4 digits by default. If you wanna see 5 digits you have to use that construction.

 
Roger09:
Comment() and Print() show you only 4 digits by default. If you wanna see 5 digits you have to use that construction.

Oh, Okay. It struck me this morning Wolfe's example gave me a result but it actually wasn't the correct result since it was returning the value of point * the number of decimals. In your example it's displaying the correct result of point. I learned a couple of things, thanks to both of you.

 

Is there any way to get the minimum Lotsize (e.g. 0.01) and the steps from a broker?

Thanks in advance :-)

 

MarketInfo - MQL4 Documentation

It's in MarketInfo(). Make sure you click on 'request identifiers'.

jan100:
Is there any way to get the minimum Lotsize (e.g. 0.01) and the steps from a broker? Thanks in advance :-)
 

Thank you. That's exactly what I was looking for. sometimes it's so easy.....

 

Placing Double Orders

Can anyone tell me how to program an EA to place double orders (one buy and one sell) at the beginning of each minute with their respective stop loss and target profit?

thanks

dptrade

Reason: