MQL4 bug??

 
I wrote a MQL4 program which buys and sells currencies based on RSI indicator. I found a bug in the software, after each trade, it is resetting program variables to default values specified in the program instead of reusing input parameters specified at runtime.
 
I wrote a MQL4 program which buys and sells currencies based on RSI indicator. I found a bug in the software, after each trade, it is resetting program variables to default values specified in the program instead of reusing input parameters specified at runtime.

I do not see your code but it appears like you have not set your variable "static".
 
declare the variable outside the Start() and it won't do that. and don't use extern.

static is probably a more elegant solution.
 
I specified following global variables:

extern double StopLoss = 15;
extern double TrailingStop = 50;

If I pass new values to these variables when I attach MQL expert to a chart, MQL program works fine for first trade but after first trade, it reinitialize these variablers to 15 and 50.

These are global variables and my init and deinit functions are empty. I am not changing these variables anyware in the program.

I also want to know how to exit from a MQL program progamatically?
 
I specified following global variables:

extern double StopLoss = 15;
extern double TrailingStop = 50;

If I pass new values to these variables when I attach MQL expert to a chart, MQL program works fine for first trade but after first trade, it reinitialize these variablers to 15 and 50.

These are global variables and my init and deinit functions are empty. I am not changing these variables anyware in the program.

I also want to know how to exit from a MQL program progamatically?

That is correct I was also gravely confused about this phenomenon.
See "Expert/Indicator"

There are two Start() indicator cycles within one tick. One for Indicator and second for Expert.
You must understand that the Expert's external variables are set only for Expert's cycle and not for Indicator one.
 
I tried to reproduce this and I can't. It is working fine for me and is not re-initializing the variables. But, like I've said before, I'm using the "old" build 186. I'm waiting until the autoupdate fires before I d/l a new one.

There are a lot of little nasty bugs being reported. MQ, what are you doing? Perhaps in a year....
 
I am not using any custom indicator, I am only using expert.

How do I found out account trade history programatically ( What currencies I traded today and yesterday)?
 
I wrote a MQL4 program which buys and sells currencies based on RSI indicator. I found a bug in the software, after each trade, it is resetting program variables to default values specified in the program instead of reusing input parameters specified at runtime.


If you have indicator attached to other charts during tests, this could create such problem in my opinion. It's only suggestion...
Reason: