Can I change the _AppliedPrice default value for an indicator?

 

Dear devels,

Is it possible to change the default _AppliedPrice for a custom indicator? It always start with Close when inserted in a graph. Anyone knows how to force it initiate with another value?

 
b2tradingclub: Dear devels, Is it possible to change the default _AppliedPrice for a custom indicator? It always start with Close when inserted in a graph. Anyone knows how to force it initiate with another value?

No, you can't force a default for when a custom indicator uses the applied price form of the OnCalculate event handler.

 
Fernando Carreiro #:

No, you can force a default for when a custom indicator uses the applied price form of the OnCalculate event handler.

Dear Fernando, there is a solution for that. I read in the forum that you can use property indicator_applied_price, like this: #property indicator_applied_price PRICE_CLOSE

I will test it!

 
b2tradingclub #: Dear Fernando, there is a solution for that. I read in the forum that you can use property indicator_applied_price, like this: #property indicator_applied_price PRICE_CLOSE. I will test it!

I was unaware of that possibility. So I searched the documentation and found it there ...Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)

indicator_applied_price

int

Specifies the default value for the "Apply to" field. You can specify one of the values of ENUM_APPLIED_PRICE. If the property is not specified, the default value is PRICE_CLOSE

Thank you for the update.

 
Fernando Carreiro #:

I was unaware of that possibility. So I searched the documentation and found it there ...Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)

indicator_applied_price

int

Specifies the default value for the "Apply to" field. You can specify one of the values of ENUM_APPLIED_PRICE. If the property is not specified, the default value is PRICE_CLOSE

Thank you for the update.

You are welcome, sir!

Reason: