indicator_applied_price

 

in a custom Indicator, I have

int OnCalculate(const int _rates_total,

                const int _prev_calculated,

                const int _begin,

                const double &_price[])

"_price" brings  "price close" by default and can bring "median" "typical" etc... 

as set in  

#property indicator_applied_price PRICE_CLOSE

 OK

Now, the question is......

what do I need to do if I need to set "applied_price" 

not as "Parameters"  but by "Inputs"

i mean, I write a line in "inputs" OK 

input ENUM_APPLIED_PRICE xMAAppliedPr=PRICE_WEIGHTED  ; 

and then ? .... 

 

 

Thanks ! 

Step on New Rails: Custom Indicators in MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
 
MQLAngel:

in a custom Indicator, I have

int OnCalculate(const int _rates_total,

                const int _prev_calculated,

                const int _begin,

                const double &_price[])

"_price" brings  "price close" by default and can bring "median" "typical" etc... 

as set in  

#property indicator_applied_price PRICE_CLOSE

 OK

Now, the question is......

what do I need to do if I need to set "applied_price" 

not as "Parameters"  but by "Inputs"

i mean, I write a line in "inputs" OK 

input ENUM_APPLIED_PRICE xMAAppliedPr=PRICE_WEIGHTED  ; 

and then ? .... 

 

 

Thanks ! 


 

 

 

I don't quite understand - what do you expect to happen then? After inserting such line with input parameter in your code you should just be able to select xMAAppliedPr type from a dropbox in a parameter window of your EA, that's all.
 
Enigma71fx:
I don't quite understand - what do you expect to happen then? After inserting such line with input parameter in your code you should just be able to select xMAAppliedPr type from a dropbox in a parameter window of your EA, that's all.

I have now my desired applied price in the variable xMAAppliedPr OK

let's say,  xMAAppliedPr = "typical"  i.e. (high + low+ close)/3

and, now the question 

what should I do in order to...    "_price" (which comes from OnCalculate)

brings now the "typical" price instead the default "close" price?