How to apply indicator with specified parameters from EA?

 

Hi,

I tried to load indicator from EA using this ChartApplyTemplate function. 

But I don't know how to load with specified indicator parameters, When I tried with template it was load by default params.

Like iCustom function with parameters, how to pass indicator parameters to load on template when a button is clicked in EA?

Any suggestions

Thanks.

ChartApplyTemplate - Chart Operations - MQL4 Reference
ChartApplyTemplate - Chart Operations - MQL4 Reference
  • docs.mql4.com
Applies a specific template from a specified file to the chart. The command is added to chart message queue and executed only after all previous commands have been processed. The Expert Advisor will be unloaded and will not be able to continue operating in case of successful loading of a new template to the chart it is attached to. Live Trading...
 
Praveen Elango:

Hi,

I tried to load indicator from EA using this ChartApplyTemplate function. 

But I don't know how to load with specified indicator parameters, When I tried with template it was load by default params.

Any suggestions

Thanks.

if u post ur code, it would be easy to help u.

Open notepad and drag your template file (with extension *.tpl) into it. You can see what settings are stored in the template.

Regarding inputs , i give a sample from my expert. It is saved in the following format in the template file.

<expert>

name=PPan

flags=343

window_num=0

<inputs>

LotSize_1=0.01

LotSize_2=0.02

LotSize_3=0.03

LotSize_4=0.04

LotSize_5=0.05

LotSize_6=0.1

LotSize_7=0.2

LotSize_8=0.3

LotSize_9=0.4

LotSize_10=0.5

LotSize_11=1.0

LotSize_12=2.0

LotSize_13=3.0

LotSize_14=4.0

LotSize_15=5.0

</inputs>

</expert>


I changed the settings directly in the template file. It worked perfectly. Although i did it on expert inputs, it should work fine for indicators too.

 
Balachandran Chandrasekar: if u post ur code, it would be easy to help u.
Please don't write ur - it's "you are" or "your" - MQL4 programming forum
 

Thanks for the reply.

As you said should I edit every time update when I change parameters in EA so that it will apply.


In your example, how can you change the input LotSize_1=0.01 to LotSize_1 = 0.5

That's what I'm looking for. So that I can pass different parameter from EA to indicator.