Hello
I got many charts opened(USDJPY,GBPUSD,...) at the same time in my mt4 plateforme
In one of this chart ,runs an EA
Visually we can see in which chart it runs
But is it possible programly to know the chart ID number in which the EA runs between all others
Regards
well you could code the ea to send a notification to your phone app or just make a printout in the experts journal every time a new orders is opened with specific details of traded symbol, chart period and so on...
the problem is with global variables (GlobalVariableGet, GlobalVariableSet)
Here is :
I've created a global variable "myGlbVar".It has been done in an EA running in usdjpy chart. And it contains its chart number.
datetime t = GlobalVariableSet("myGlbVar",ChartID());
Lets say the chart number of usdjpy is 132302888707960286
I m trying to recover it in an indicator running in another chart
double j = GlobalVariableGet("myGlbVar");
it doesnt give me the right chart number as expected
But either like 132302888707960289 with 3 points different !
Why. And how to get datas from one chart to another one without any false.
- www.mql5.com
Double-precision floating-point format - Wikipedia, the free encyclopedia
You can't store a long (chart id) with 19 digits. You can split it up, or create a GV who's name includes the id.
Why do you want to? The (only) EA knows its own chart id.
You can create a GV who's name includes the id.
may you explain more by giving an example
#define PREFIX "myGlbVar" #define PREFIX_LEN 8 GlobalVariableSet(PREFIX+(string)132302888707960286,0); long cid; for(int i=GlobalVariablesTotal()-1; i>=0; --i){ string name = GlobalVariableName(i); if (PREFIX == StringSubstr(name,0,PREFIX_LEN) ){ cid = (long) StringSubstr(name,PREFIX_LEN); break; } } Print(cid);
good tips
tnx
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I got many charts opened(USDJPY,GBPUSD,...) at the same time in my mt4 plateforme
In one of this chart ,runs an EA
Visually we can see in which chart it runs
But is it possible programly to know the chart ID number in which the EA runs between all others
Regards