Trying to understand the second form of IsTradeAllowed?
Update 04/03/21 at 19:55
I have now discovered that if I right click on the Market Watch and select: show all, then more symbols appear. I can then see that some symbols are greyed out and some symbols are not. The symbols that are not greyed out e.g. USDGBP-g return what I would expect when running the program above i.e. alert 1-alert 4 =true. The symbols that are greyed out e.g. USDGBP returns true; true; false; false in the program above. I now have two questions:
-
Why does: IsTradeAllowed(NULL, TimeGMT()); //alert 2 return true for symbols that are greyed out?
-
What does -g mean in GBPUSD-g?
Please see the script below:
void OnStart()
{
Alert(Symbol());
Alert(IsTradeAllowed(NULL, TimeGMT()));
Alert(IsTradeAllowed(Symbol(), TimeGMT()));
Alert(IsTradeAllowed("GBPUSD", TimeGMT()));
}
It returns: EURUSD true false false. Why does it not return: URUSD true true true. I tried it at breakfast; lunch; dinner and supper today and got the same results each time.
Also what does null mean (I believe it means the chart selected in MT4 is used, but I am looking at the GBPUSD chart in MT4)? I have read the docs here: IsTradeAllowed - Checkup - MQL4 Reference , which didn't really help.
I realise IsTradeAllowed (with no arguements) checks that AutoTrading is enabled.