I am fine-tuning the CrossArbitr indicator. Help me to understand. I need the value of b(Total) summed s for a minute (0 bar) and displayed with the other indicators on the chart, after a minute the sum s was fixed, s1=s, start to form again. Indicator s1 one also needs to be displayed on the chart. Here is the code of the indicator.
//+------------------------------------------------------------------+//| CrossArbitr.mq4 |//| Scriptong |//| |//+------------------------------------------------------------------+#property copyright"Scriptong"#property link""#property indicator_chart_window//---- input parametersexternbool ShowBid=false;
externbool ShowAsk=false;
externcolor BidColor = Lime;
externcolor AskColor = Yellow;
externint AlarmIfPointDifference = 10;
externstring AlarmFile = "wait.wav";
bool Activate = False;
string FP, SP;
double Tick;
int WayForCross;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init()
{
//---- indicatorsstring S = Symbol();
if(StringFind(S, "USD", 0) != -1)
{
Comment("Индикатор работает только с кроссовыми парами (GBPJPY, EURJPY, EURGBP и т. д)!");
return(0);
}
if(StringLen(S) != 6)
{
Comment("Индикатор работает только с валютными парами, у которых название состоит из шести символов!");
return(0);
}
// Поиск первой валютной пары кросса
FP = StringSubstr(S, 0, 3)+"USD";
MarketInfo(FP, MODE_BID);
if(GetLastError() > 0)
{
FP = "USD"+StringSubstr(S, 0, 3);
MarketInfo(FP, MODE_BID);
if(GetLastError() > 0)
{
Comment("Невозможно найти инструмент ", FP, " или ", StringSubstr(S, 0, 3)+"USD. Необходимо добавить его в Обзоре рынка и перезапустить индикатор.");
return(0);
}
}
// -------------------------------------- // "Создание" второй валютной пары кросса
SP = "USD"+StringSubstr(S, 3, 3);
MarketInfo(SP, MODE_BID);
if(GetLastError() > 0)
{
SP = StringSubstr(S, 3, 3)+"USD";
MarketInfo(SP, MODE_BID);
if(GetLastError() > 0)
{
Comment("Невозможно найти инструмент ", SP, " или ", StringSubstr(S, 3, 3)+"USD. Необходимо добавить его в Обзоре рынка и перезапустить индикатор.");
return(0);
}
}
// -------------------------------------- // Определение пути синтеза кроссаif (StringFind(FP, "USD") == 3 && StringFind(SP, "USD") == 0)
WayForCross = 1;
if (StringFind(FP, "USD") == 0 && StringFind(SP, "USD") == 0)
WayForCross = 2;
if (StringFind(FP, "USD") == 3 && StringFind(SP, "USD") == 3)
WayForCross = 3;
if (StringFind(FP, "USD") == 0 && StringFind(SP, "USD") == 3)
WayForCross = 4;
// -------------------------------
Tick = MarketInfo(Symbol(), MODE_TICKSIZE);
Activate = True;
//----return(0);
}
//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+int deinit()
{
//----Comment("");
if(ObjectFind("CrossBid") == 0)
ObjectDelete("CrossBid");
if(ObjectFind("CrossAsk") == 0)
ObjectDelete("CrossAsk");
//----return(0);
}
//+------------------------------------------------------------------+//| Приведение значений к точности одного тика |//+------------------------------------------------------------------+double ND(double A)
{
return(NormalizeDouble(A, Digits));
}
//+------------------------------------------------------------------+//| Расчет значения синтетического бида |//+------------------------------------------------------------------+double CalcBidWayForCross()
{
switch (WayForCross)
{
case1: return(ND(MarketInfo(FP, MODE_BID)*MarketInfo(SP, MODE_BID)));
case2: return(ND(MarketInfo(SP, MODE_BID)/MarketInfo(FP, MODE_ASK)));
case3: return(ND(MarketInfo(FP, MODE_BID)/MarketInfo(SP, MODE_ASK)));
case4: return(1/(ND(MarketInfo(FP, MODE_ASK)*MarketInfo(SP, MODE_BID))));
}
}
//+------------------------------------------------------------------+//| Расчет значения синтетического аска |//+------------------------------------------------------------------+double CalcAskWayForCross()
{
switch (WayForCross)
{
case1: return(ND(MarketInfo(FP, MODE_ASK)*MarketInfo(SP, MODE_ASK)));
case2: return(ND(MarketInfo(SP, MODE_ASK)/MarketInfo(FP, MODE_BID)));
case3: return(ND(MarketInfo(FP, MODE_ASK)/MarketInfo(SP, MODE_BID)));
case4: return(1/(ND(MarketInfo(FP, MODE_BID)*MarketInfo(SP, MODE_ASK))));
}
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int start()
{
int counted_bars=IndicatorCounted();
//----if(!Activate)
return(0);
// Расчет синтетических Bid и Askdouble CalcBid = CalcBidWayForCross();
RefreshRates();
double CalcAsk = CalcAskWayForCross();
double n,m,b,s,s1;
int t = Seconds();
// -------------------------------// Рисуем уровень синтетического Bidif (ShowBid)
{
if(ObjectFind("CrossBid") == -1)
{
ObjectCreate("CrossBid", OBJ_HLINE, 0, 0, CalcBid);
ObjectSet("CrossBid", OBJPROP_COLOR, BidColor);
ObjectSet("CrossBid", OBJPROP_STYLE, STYLE_DOT);
}
elseif(!ObjectMove("CrossBid", 0, 1, CalcBid))
Print("Ошибка перемещения №", GetLastError());
}
// ---------------------------------- // Рисуем уровень синтетического Askif(ShowAsk)
{
if(ObjectFind("CrossAsk") == -1)
{
ObjectCreate("CrossAsk", OBJ_HLINE, 0, 0, CalcAsk);
ObjectSet("CrossAsk", OBJPROP_COLOR, AskColor);
ObjectSet("CrossAsk", OBJPROP_STYLE, STYLE_DOT);
}
elseObjectMove("CrossAsk", 0, 1, CalcAsk);
if(t > 0)
{s=b; b++;}
else s1=s;
}
// ---------------------------------- Comment("Реальный BID = ", DoubleToStr(Bid, Digits), ", реальный ASK = ", DoubleToStr(Ask, Digits),
"\nСинтетик BID = ", DoubleToStr(CalcBid, Digits), ", синтетик ASK = ", DoubleToStr(CalcAsk, Digits),
"\nРазница BID Синтетика и Реального =", n=(Bid-CalcBid),
"\, Разница ASK Синтетика и Реального =", m=(CalcAsk-Ask),
"\nИтог =", b=(CalcAsk-Ask) - (Bid-CalcBid),
"\nПрошлый бар =", s1, ", Текущий бар =", s
);
// Выдаем звуковой сигнал о превышении минимальной разностиif(ND(MathAbs(CalcBid-Bid)) >= ND(AlarmIfPointDifference*Point))
PlaySound(AlarmFile);
// -------------------------------------------------------- //----return(0);
}
//+------------------------------------------------------------------+
Also, I am trying to install an Exp-Monitoring-Spread Expert Advisor on a chart - it is not installed. MT4 writes in the log that it is not an Expert Advisor and cannot be installed. No errors in the compiler have been detected. It runs as a script, but the offline chart does not work. What can be done? The code is attached just in case.
ganri: Is it possible to fix an EA where you want to replace the normal open trades with a trailing stop?
If the Expert Advisor was generated using the MQL Wizard, then it is easy - when creating an EA, you need to specify that a trailing stop is needed and select what the trailing stop will be based on.
barabashkakvn: If the Expert Advisor was generated using the MQL Wizard, it is easy - when creating an EA, you need to specify that a trailing stop is needed and select what the trailing stop will be based on.
Is it possible to download charts for technical analysis, - indexes S & P 500 Futures Chart, TA 25 Chart, and S & P 500 Chart if it is possible can tell you how to do it, maybe there is an explanation of how to download! I thank you in advance.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
right?
It shows error. Did everything work fine?
can't open "C:\Program Files\Alpari Limited MT5 Demo 1\MQL5\include\Expert\Signal\MySignals\ACH_HM_RSI.include file expert_ah_hm_rsi.mq5 14 11
It shows error. Did everything work fine?
can't open "C:\Program Files\Alpari Limited MT5 Demo 1\MQL5\include\Expert\Signal\MySignals\ACH_HM_RSI.include file expert_ah_hm_rsi.mq5 14 11
I do.
put the files in the specified folders.
I am.
put the files in the specified folders.
Thanks, it's working! :)
Hi all!
I am fine-tuning the CrossArbitr indicator. Help me to understand. I need the value of b(Total) summed s for a minute (0 bar) and displayed with the other indicators on the chart, after a minute the sum s was fixed, s1=s, start to form again. Indicator s1 one also needs to be displayed on the chart. Here is the code of the indicator.
Also, I am trying to install an Exp-Monitoring-Spread Expert Advisor on a chart - it is not installed. MT4 writes in the log that it is not an Expert Advisor and cannot be installed. No errors in the compiler have been detected. It runs as a script, but the offline chart does not work. What can be done? The code is attached just in case.
Is it possible to fix an EA where you want to replace the normal open trades with a trailing stop?
If the Expert Advisor was generated using the MQL Wizard, it is easy - when creating an EA, you need to specify that a trailing stop is needed and select what the trailing stop will be based on.
I thank you in advance.