Simple question regarding using default values in function calls. New comment isac_rc 2014.12.12 21:51 As the topic suggests, I want to find out how to "skip" a parameter while calling a function.Being specific, I want to skip the price parameter (thus making the Buy function use default price such as SYMBOL_ASK)m_Trade.Buy(lots,symbol,price,stoploss,takeprofit,comment);So there it is, I want to skip the parameter in red, such as follows:M_Trade.Buy(1,my_symbol,0,50,300,NULL);If I use 0, the EA doesn't fire up as prices never turns to zero. What value can I use to determine I want to use current price on my Buy function?Thanks a ton! Obtain the price of an open position [WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. Stuart Browne 2014.12.13 00:34 #1 Why don't you just add an if statement inside the function which checks the value of the price parameter and changes it if it's zero:if (price==0) price=Ask; isac_rc 2014.12.13 04:31 #2 Filter: Why don't you just add an if statement inside the function which checks the value of the price parameter and changes it if it's zero:Brilliant.. this might work. I'll give it a shot! Thank you. Stuart Browne 2014.12.13 06:23 #3 Welcome mate :) New comment
As the topic suggests, I want to find out how to "skip" a parameter while calling a function.
Being specific, I want to skip the price parameter (thus making the Buy function use default price such as SYMBOL_ASK)
m_Trade.Buy(lots,symbol,price,stoploss,takeprofit,comment);
So there it is, I want to skip the parameter in red, such as follows:
M_Trade.Buy(1,my_symbol,0,50,300,NULL);
If I use 0, the EA doesn't fire up as prices never turns to zero. What value can I use to determine I want to use current price on my Buy function?
Thanks a ton!