Download MetaTrader 5

using _Point?

To add comments, please log in or register
What is MetaQuotes ID? Find that out from the article!
sentinelx
44
sentinelx 2012.08.05 11:37 

Hello,

I am coding a condition for buy like this:- bool Buy_Condition1 = (p_close > hand1[1])  && (p_close - hand1[1] > 20*_Point)

But upon backtesting, position gets opened with (p_close > hand1[1]) even if the second condition has not been true yet.

I want there to be a distance of atleast 20pips between my indicator handle value and bar close price. Can anyone point mistake in my code condition please? 

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
enbo lu
Moderator
1947
enbo lu 2012.08.05 16:29  


try this: bool Buy_Condition1 = ( (p_close > hand1[1])  && (p_close - hand1[1] > 20*_Point) );

sentinelx
44
sentinelx 2012.08.05 17:52  
luenbo:


try this: bool Buy_Condition1 = ( (p_close > hand1[1])  && (p_close - hand1[1] > 20*_Point) );

thanks for replying luenbo,

In my code i am using this exact bracket and semi colon placement as you have shown, the syntax in my code is all correct because i do not have any error or warning in compilation, i missed them posting in my message, sorry about that.

But the problem is that (p_close-hand1[1]>20*_Point) part is not showing in the working of this code. Any suggestion about it will be most welcome.

thanks again luenbo. 

kaloian kaloianov
445
kaloian kaloianov 2012.08.13 09:25  

if you have not sloved your problem yet try to normalize p close values to 5 digits..check doubletostr funaction and normalize double.

Paul Anscombe
3996
Paul Anscombe 2012.08.14 08:59  

Don't forget that a point is not necessarily the same size as a tick.

 

IE: for most 5 digit brokers  a pip is  0.0001 on eurusd and a point is 0.00001  so 20 pips would be  200 points

 

 

To add comments, please log in or register