REASON_CHARTCHANGE --> OnInit()

To add comments, please log in or register
svengralla
96
svengralla  

Hi,

is there a way to pass the reason for deinitializiation to the new initialization process?

The only way I can think of is using global terminal variables.


Sven

Rogerio Figurelli
Moderator
51688
Rogerio Figurelli  
svengralla:

Hi,

is there a way to pass the reason for deinitializiation to the new initialization process?

The only way I can think of is using global terminal variables.


Sven

Hi svengralla, there are several ways. Another way could be an IO file or a Log file, for instance.

svengralla
96
svengralla  
figurelli:

Hi svengralla, there are several ways. Another way could be an IO file or a Log file, for instance.


Ok, thank you.

Franz Hall
136
Franz Hall  
svengralla:

Hi,

is there a way to pass the reason for deinitializiation to the new initialization process?

The only way I can think of is using global terminal variables.


Sven

You don´t need to pass it because the terminal has stored it at deinit.

In the OnInit() function you just analyze the reason.

switch(UninitializeReason())
     {
      case REASON_CHARTCLOSE:   break;
      case REASON_REMOVE:  break;
      case REASON_RECOMPILE:  break;
      case REASON_CHARTCHANGE: break;
      case REASON_PARAMETERS:  break;
      case REASON_ACCOUNT: break; 
     }
Alain Verleyen
36130
Alain Verleyen  
fxtr51:

You don´t need to pass it because the terminal has stored it at deinit.

In the OnInit() function you just analyze the reason.

switch(UninitializeReason())
     {
      case REASON_CHARTCLOSE:   break;
      case REASON_REMOVE:  break;
      case REASON_RECOMPILE:  break;
      case REASON_CHARTCHANGE: break;
      case REASON_PARAMETERS:  break;
      case REASON_ACCOUNT: break; 
     }

Hello,

Please use the SRC button when you post code. Thank you.


About your solution, this doesn't work in all cases. For example if the chart is closed, so your EA is completely removed from memory, and you don't receive this value with UninitializeReason().

Franz Hall
136
Franz Hall  
angevoyageur:

About your solution, this doesn't work in all cases. For example if the chart is closed, so your EA is completely removed from memory, and you don't receive this value with UninitializeReason().

Yes, I see.

In my case the chart is not closed, but if we have to take that possibility into account, it is necessary to save the value in a file.

Thanks for clarifying it.

To add comments, please log in or register