This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

If Statements... setting two variables equal to each other;$10 PAYPAL FOR YOUR HELP


Back to topics list
avatar
4
tkrichman 2009.11.19 02:48 

not sure how to write an if statement when I want to have two variables equal each other.


...


if(P = bid)

{

SendMail("MT4 Alert", "Price has reached Pivot Point");

}


P is a calculated value which works fine, Bid is the current bid price.


However this does not work giving me

'=' - illegal assignment used C:\Program Files\Interbank FX Trader 4\experts\indicators\Pivots_Daily EMAIL1.mq4 (391, 12)
'Bid' - unexpected token C:\Program Files\Interbank FX Trader 4\experts\indicators\Pivots_Daily EMAIL1.mq4 (391, 14)
')' - assignment expected C:\Program Files\Interbank FX Trader 4\experts\indicators\Pivots_Daily EMAIL1.mq4 (391, 17)


Thanks in advanced for your help.

avatar
11
johnnyBoy 2009.11.19 13:05 

trichman, comparing two values is done using '=='.


When '=' is used, you're telling the program to change the value of the variable to a new one.


So your code should look like this:


if(P == bid)

{

SendMail("MT4 Alert", "Price has reached Pivot Point");

}

avatar
21
boom007 2009.11.22 23:37 
wow its a programiing how i can start this i m also php mysql programmer can i know thais
avatar
21
milky101 2009.11.23 00:09 
yes boom ur right
Back to topics list  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets