How can I define a default parameter for a function?
Hi,
So you can do as this :
double ClosePrice(string symbol, int timeframe=0, int position=1) { return iClose(symbol, timeframe, position); }
"position=1" is for one bar before current bar,And "timeframe=0" is for current chart timeframe,so you can leave them empty during function calling:
double price = ClosePrice("EURUSD");Regards.
Hi,
So you can do as this :
"position=1" is for one bar before current bar,And "timeframe=0" is for current chart timeframe,so you can leave them empty during function calling:
Regards.Exactly what I was looking for. Thank you very much!
Exactly what I was looking for. Thank you very much!
You're welcome.
Hi guys,
pretty difficult to explain in a headline. I have this function:
And I call this function like this:
Now I want to define the default parameter "position" as 1 if there is no position parameter given.
So I want to do this:
And the result should be the closeprice of EURUSD H1 of candle 1.
Is that possible? I know it is when using some MT4 functions.