// The indicator cuts off all attempts to trade via Expert Advisors. It only allows to trade with hands.// To avoid temptation to switch it off while the Terminal is running, the indicator is in invisible mode.#property indicator_chart_window#property indicator_buffers0#property indicator_plots0#include <Symbol.mqh> // https://www.mql5.com/en/code/18855#include <fxsaber\Expert.mqh> // https://www.mql5.com/en/code/19003void MyAlert( conststring Str )
{
string StrArray[];
for (int i = StringSplit(Str, '\n', StrArray) - 1; i >= 0; i--)
Alert(StrArray[i]);
}
bool NextOnCalculate( conststring SymbName = NULL )
{
const SYMBOL Symb(SymbName);
MqlRates Rates[1] = {0};
Rates[0].time = TimeCurrent();
return(Symb.IsCustom() ? Symb.CloneRates(Rates) : ChartSetSymbolPeriod(0, _Symbol, _Period));
}
const SYMBOL SymbTimer("Timer");
voidOnInit()
{
if (_Symbol == SymbTimer.Name)
ChartIndicatorGet(0, 0, ChartIndicatorName(0, 0, 0));
elseif (SymbTimer.IsExist() && SymbTimer.On() && NextOnCalculate(SymbTimer.Name))
{
iCustom(SymbTimer.Name, PERIOD_CURRENT,
".." + StringSubstr(MQLInfoString(MQL_PROGRAM_PATH), StringLen(TerminalInfoString(TERMINAL_PATH)) + 5));
SymbTimer.Off();
}
}
string GetExpertData( constulong Chart = 0 )
{
string Str = NULL;
MqlParam Parameters[];
string Names[];
if (EXPERT::Parameters(Chart, Parameters, Names))
{
Str += "\n" + ::ChartSymbol(Chart) + " " + ::EnumToString(::ChartPeriod(Chart)) + " " + Parameters[0].string_value + "\n";
constint Amount = ::ArraySize(Names);
for (int i = 0; i < Amount; i++)
Str += (string)i + ": "+ Names[i] + " = " + Parameters[i + 1].string_value + "\n";
}
return(Str);
}
void Active( constint AlertTime = 5 )
{
staticconstuint StartTime = GetTickCount();
staticuint PrevInterval = 0;
constuint Interval = (GetTickCount() - StartTime) / 1000;
conststring Str = MQLInfoString(MQL_PROGRAM_NAME) + ": I've been watching you for " + TimeToString(Interval, TIME_SECONDS);
long Chart = ChartFirst();
if (Chart != -1)
do
{
if (EXPERT::Is(Chart))
MyAlert(GetExpertData(Chart) + "Removed - " + (string)EXPERT::Remove(Chart));
ChartSetString(Chart, CHART_COMMENT, Str);
ChartRedraw(Chart);
}
while ((Chart = ChartNext(Chart)) != -1);
elseif (!(Interval % AlertTime) && (Interval != PrevInterval))
{
MyAlert(Str);
PrevInterval = Interval;
}
}
intOnCalculate( constint, constint, constint, constdouble &[] )
{
staticint i = 0;
if ((_Symbol == SymbTimer.Name) && NextOnCalculate())
Active();
elseif (i++ > 0)
ChartIndicatorDelete(0, 0, ChartIndicatorName(0, 0, ChartIndicatorsTotal(0, 0) - 1));
return(0);
}
HI If you restart the terminal, you may sometimes encounter (MT5 build 1881) that it hangs in processes. You can overcome this by forcibly removing the corresponding terminal64.exe process and deleting MetaTrader 5\Bases\Custom\history\Timer\*.hcc.
В наше время информационных технологий использование различных роботов и электронных экспертов для торговли на финансовых рынках стало довольно обычным явлением. Главными преимуществами электронных экспертов принято считать безукоризненное выполнение алгоритма и безустанная работа 24 часа в сутки. Для их круглосуточного использования арендуются...
I.e. save the chart template, read it, parse it and find the name of the Expert Advisor. It's still a crutch, but it works well so far (for about a couple of months). I think that if you use a regular HDD, you should not do this too often (for example, on every tick). I hope CHART_EXPERT_NAME will appear in MQL4 someday .
It is not very similar to my use case. The main question about the example is what happens if the name of the music file is specified in a script parameter, instead of throwing it through global variables? I can send you my project in a private message.
It is not very similar to my use case. The main question about the example is what happens if the name of the music file is specified in a script parameter instead of being thrown through global variables?
I don't remember the reason at all, but the option with an input parameter is immediately suggested. Since the example is so twisted, it must be a limitation of MT5.
Oh, those Russian hackers.... Well, why stop all the experts when you're a little screwed?
By the way, you also have a bug. Static doesn't work.
By the way, you also have a bug. Static doesn't work.
I did not see an error here
Forum on trading, automated trading systems and testing trading strategies.
Questions from beginners MQL5 MT5 MetaTrader 5
fxsaber, 2018.08.02 17:09
HI If you restart the terminal, you may sometimes encounter (MT5 build 1881) that it hangs in processes. You can overcome this by forcibly removing the corresponding terminal64.exe process and deleting MetaTrader 5\Bases\Custom\history\Timer\*.hcc.
In the article the author has highlighted in great detail the nuances of the results of this library. I recommend to read it.
MT4 happens to be missing a lot more than FileSave and FileLoad (which are written in 3 lines each):
In my project, I solved it this way (with the "name" tag):
Where SubstringParser has this code:
I.e. save the chart template, read it, parse it and find the name of the Expert Advisor. It's still a crutch, but it works well so far (for about a couple of months). I think that if you use a regular HDD, you should not do this too often (for example, on every tick). I hope CHART_EXPERT_NAME will appear in MQL4 someday .
Will there be a new version with support for running scripts?
Doesthis example not work?
This example doesn't work?
It is not very similar to my use case. The main question about the example is what happens if the name of the music file is specified in a script parameter, instead of throwing it through global variables? I can send you my project in a private message.
It is not very similar to my use case. The main question about the example is what happens if the name of the music file is specified in a script parameter instead of being thrown through global variables?
I don't remember the reason at all, but the option with an input parameter is immediately suggested. Since the example is so twisted, it must be a limitation of MT5.