How to remember new value of extern parameter of custom indicator when its edited/change internally ?

Back to topics list To post a new topic, please log in or register
avatar
2
xfn 2015.09.06 21:03
 

     I am having a custom indicator which accepts 3 extern variables as input (1)Signal_Type, (2)Entry_DateTime & (3)Entry_Price. With the help of these inputs indicator plots some objects on the chart as depicted in image below.

 


This custom indicator allows user to edit these extern variables in 2 ways
     Case 1 : Input dialogbox of Custom indicator (Which is very common & standard method)
     Case 2 : On combination of Chart Events (CHARTEVENT_KEYDOWN + CHARTEVENT_MOUSE_MOVE)

     In case 1 on editing inputs, custom indicator works perfectly. As the MT4 terminal raises custom indicator events OnDeinit (with REASON_PARAMETER) & OnInit, It remembers the new set of input parameters values even if we change the timeframe of chart OR restart the MT4 terminal with the indicator on chart, till the user edit these parameters again by using Input dialogbox of Custom indicator 

     In case 2 on editing inputs, custom indicator perfectly plots objects on chart but it neither raises custom indicator events OnDeinit (with REASON_PARAMETER) & OnInit nor remembers the new set of input parameters forever like in case 1. And whenever we change the timeframe of chart OR restart the MT4 terminal after case 2, the terminal invoke custom indicator either with default parameter values or with the parameter values that were set by using case 1 before the case 2

Well one more thing that I forgot to mention

     While editing these parameters using case 2, the chart events return good values of Signal_Type & Entry_DateTime parameters but Entry_Price parameter has approximate nearby values. So whenever I open the input dialog-box to correct this Entry_Price, I found that the input dialog-box contains old values for all three parameters Signal_Type, Entry_DateTime & Entry_Price. It never got updated as depicted in image below



So, Is there any way to make custom indicator remember those new set parameter values edited using case 2 ? (other than disk operation)
Or, Is there any way to raise those custom indicator events OnDeinit (with REASON_PARAMETER) & OnInit ?
Attached files:
  sample.mq4  (3.40 KB)
avatar
1109
Ovo 2015.09.06 21:34 #
 

1. I save them to a chart as label objects, and read & delete them on init. I monitor the deinit reason for params-change or indicator detach, those should not save anything 

2. I only know of possibility to invoke the reload by ChartSetSymbolPeriod , but it works only on regular charts (not the offline ones)

avatar
2
xfn 2015.09.08 07:01 #
 

1. I save them to a chart as label objects, and read & delete them on init. I monitor the deinit reason for params-change or indicator detach, those should not save anything

That's may be the solution. Let me try...

Well, It may not solve the one problem that I forgot to mention; Please check the original post. it also contains a image & sample code.


avatar
125
zirkoner 2015.09.08 08:01 #
 
xfn:

1.I save them to a chart as label objects, and read & delete them oninit. I monitor the deinit reason for params-change or indicator detach,those should not save anything

That's may be the solution. Let me try...

Well, It may not solve the one problem that I forgot to mention; Please check the original post. it also contains a image & sample code.


Not possible to update the values in the Inputs window (at least in an easy way).
Back to topics list  

To add comments, please log in or register