Greetings, please don't kick me too much) I have an EA. I want to implement in it the function of opening a position, if on several currency pairs, a bar with index 1, has the same direction (bullish or bearish). I am trying to do it with iclose and iopen.
Все происходит в bool-ой функцие.
Хотел реализовать конструкцию следующего вида:
if ((iOpen(NULL, PERIOD_CURRENT, 1)>iClose(NULL, PERIOD_CURRENT, 1))&&(iOpen("EURGBP", PERIOD_CURRENT, 1)>iClose("EURGBP", PERIOD_CURRENT, 1))&&(iOpen("EURJPY", PERIOD_CURRENT, 1)>iClose("EURJPY", PERIOD_CURRENT, 1)))
returnfalse;
elseif ((iOpen(NULL, PERIOD_CURRENT, 1)<iClose(NULL, PERIOD_CURRENT, 1))&&(iOpen("EURGBP", PERIOD_CURRENT, 1)<iClose("EURGBP", PERIOD_CURRENT, 1))&&(iOpen("EURJPY", PERIOD_CURRENT, 1)<iClose("EURJPY", PERIOD_CURRENT, 1)))
returnfalse;
Но ничего не получилось, и открываются позиции при любой комбинации баров с индексом 1.
Но работает следующая конструкция.
if(iOpen(NULL, PERIOD_CURRENT, 1)>iClose(NULL, PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURGBP", PERIOD_CURRENT, 1)>iClose("EURGBP", PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURJPY", PERIOD_CURRENT, 1)>iClose("EURJPY", PERIOD_CURRENT, 1))
returnfalse;
Тут советник правильно находит комбинацию из баров. Но таким способом можно искать либо комбинации из бычьих баров, либо медвежьих.
Ибо код такого вида не работает.
if(iOpen(NULL, PERIOD_CURRENT, 1)>iClose(NULL, PERIOD_CURRENT, 1))
{
if(iOpen("EURGBP", PERIOD_CURRENT, 1)>iClose("EURGBP", PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURJPY", PERIOD_CURRENT, 1)>iClose("EURJPY", PERIOD_CURRENT, 1))
returnfalse;
}
elseif(iOpen(NULL, PERIOD_CURRENT, 1)<iClose(NULL, PERIOD_CURRENT, 1))
{
if(iOpen("EURGBP", PERIOD_CURRENT, 1)<iClose("EURGBP", PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURJPY", PERIOD_CURRENT, 1)<iClose("EURJPY", PERIOD_CURRENT, 1))
returnfalse;
}
И такого тоже)
if(iOpen(NULL, PERIOD_CURRENT, 1)>iClose(NULL, PERIOD_CURRENT, 1))
{
if(iOpen(NULL, PERIOD_CURRENT, 1)>iClose(NULL, PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURGBP", PERIOD_CURRENT, 1)>iClose("EURGBP", PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURJPY", PERIOD_CURRENT, 1)>iClose("EURJPY", PERIOD_CURRENT, 1))
returnfalse;
}
elseif(iOpen(NULL, PERIOD_CURRENT, 1)<iClose(NULL, PERIOD_CURRENT, 1))
{
if(iOpen(NULL, PERIOD_CURRENT, 1)<iClose(NULL, PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURGBP", PERIOD_CURRENT, 1)<iClose("EURGBP", PERIOD_CURRENT, 1))
returnfalse;
if(iOpen("EURJPY", PERIOD_CURRENT, 1)<iClose("EURJPY", PERIOD_CURRENT, 1))
returnfalse;
}
So whatis the right way tolook for combinations of bearish and bullish bars at the same time? Once again, please don't hit it too hard.)
Greetings, please don't kick me too much) I have an EA. I want to implement in it the function of opening a position, if on several currency pairs, a bar with index 1, has the same direction (bullish or bearish). I am trying to do it with iclose and iopen.
The Expert Advisor is written, let's say, on muwings. When you finish testing it in the tester, the used muvings (with used parameters) appear in the window. This is OK.
Question.
But when this EA is also uploaded to the Market and a user downloads the demo, will it also pop up after the end of the test? Or does mql have a privacy policy in this regard?
Конечно, можно самому заморочиться и проверить. Но те кто, заливал продукты, поймут, что лучше просто спросить)
The Expert Advisor is written, let's say, on muwings. When you finish testing it in the tester, the used muvings (with used parameters) appear in the window. This is OK.
Question.
But when this EA is also uploaded to the Market and a user downloads the demo, will it also pop up after the end of the test? Or does mql have a privacy policy in this regard?
Of course, it's easier to ask, but not everyone who has downloaded an EA to the market has checked it afterwards.
In fact, what difference does it make where the EA's file was obtained from? It will work the same whether it was downloaded from a developer or encrypted from the market...
The Expert Advisor is written, let's say, on muwings. When you finish testing it in the tester, the used muvings (with used parameters) appear in the window. This is OK.
Question.
But when this EA is also uploaded to the Market and a user downloads the demo, will it also pop up after the end of the test? Or does mql have a privacy policy in this regard?
Покупка торгового робота в MQL5 Маркете имеет одно большое преимущество перед всеми другими подобными предложениями - вы можете устроить комплексную проверку предлагаемой автоматической системы прямо в терминале MetaTrader 5. Каждый советник перед покупкой можно и нужно тщательно прогнать во всех неблагоприятных режимах во встроенном тестере торговых стратегий, чтобы получить о нем максимально полное представление.
Help me fix the indicator. It draws a price step/grid from a specified value. The problem is that when I remove it, the lines remain on the chart. Also, I cannot add a second indicator like it to the chart. In general, how to make it remove completely from the chart so that I can throw the same indicator on the chart with other values.
#property link"https://www.forexsystems.biz"#property version"1.00"#property indicator_chart_window//---- для расчёта и отрисовки индикатора использовано ноль буферов#property indicator_buffers0//---- использовано всего ноль графических построений#property indicator_plots0//--- входные параметры inputint count = 500; //количество линий вверх вниз от ценыinputint step = 100; //шаг линий inputdouble pr = 1.1; //цена от которой пляшем//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- indicator buffers mapping//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
Comment("");
}
//+------------------------------------------------------------------+ //| Создает горизонтальную линию | //+------------------------------------------------------------------+ bool HLine(conststring name="HLine",double price=0)
{
//--- создадим горизонтальную линию if(!ObjectCreate(0,name,OBJ_HLINE,0,0,price))
{
Print(__FUNCTION__,
": не удалось создать горизонтальную линию! Код ошибки = ",GetLastError());
return(false);
}
//--- установим цвет линии ObjectSetInteger(0,name,OBJPROP_COLOR,clrDodgerBlue);
ObjectSetInteger(0,name,OBJPROP_WIDTH,2);
return(true);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
double price=pr;
//--- создадим горизонтальную линию for(int i=0;i<=count;i++)
{
HLine("HLine"+(string)i,price+step*i*_Point);
HLine("HLine"+(string)(i+count+1),price-step*i*_Point);
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+
Help me fix the indicator. It draws a price step/grid from a specified value. The problem is that when I remove it, the lines remain on the chart. Also, I cannot add a second indicator like it to the chart. In general, how to make it delete completely from the chart, so that it is possible to add the same indicator on the chart with different values.
In OnDeinit you need to doObjectsDeleteAll- delete by prefix (in your case the prefix is "HLine")
intObjectsDeleteAll(
long chart_id, // идентификатор графикаconststring prefix, // префикс имени объектаint sub_window=-1, // индекс окнаint object_type=-1// тип объекта для удаления
);
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.
see what the retcode says after the order is sent
Thank you.
10018
TRADE_RETCODE_MARKET_CLOSED
Market is closed.
It means there is a problem with the broker.
Greetings, please don't kick me too much)
I have an EA. I want to implement in it the function of opening a position, if on several currency pairs, a bar with index 1, has the same direction (bullish or bearish).
I am trying to do it with iclose and iopen.
So whatis the right way tolook for combinations of bearish and bullish bars at the same time? Once again, please don't hit it too hard.)
Greetings, please don't kick me too much)
I have an EA. I want to implement in it the function of opening a position, if on several currency pairs, a bar with index 1, has the same direction (bullish or bearish).
I am trying to do it with iclose and iopen.
So whatis the right way tolook for combinations of bearish and bullish bars at the same time? Once again, please do not hit me with a thump.)
UseCopyRates, and make sure you control how much you have ordered and how much you have received. Here is an example:
Hello all!
Situation.
The Expert Advisor is written, let's say, on muwings. When you finish testing it in the tester, the used muvings (with used parameters) appear in the window. This is OK.
Question.
But when this EA is also uploaded to the Market and a user downloads the demo, will it also pop up after the end of the test? Or does mql have a privacy policy in this regard?
Конечно, можно самому заморочиться и проверить. Но те кто, заливал продукты, поймут, что лучше просто спросить)
Hello all!
Situation.
The Expert Advisor is written, let's say, on muwings. When you finish testing it in the tester, the used muvings (with used parameters) appear in the window. This is OK.
Question.
But when this EA is also uploaded to the Market and a user downloads the demo, will it also pop up after the end of the test? Or does mql have a privacy policy in this regard?
Of course, it's easier to ask, but not everyone who has downloaded an EA to the market has checked it afterwards.
In fact, what difference does it make where the EA's file was obtained from? It will work the same whether it was downloaded from a developer or encrypted from the market...
Hello all!
Situation.
The Expert Advisor is written, let's say, on muwings. When you finish testing it in the tester, the used muvings (with used parameters) appear in the window. This is OK.
Question.
But when this EA is also uploaded to the Market and a user downloads the demo, will it also pop up after the end of the test? Or does mql have a privacy policy in this regard?
TesterHideIndicatorsHelp me fix the indicator. It draws a price step/grid from a specified value. The problem is that when I remove it, the lines remain on the chart. Also, I cannot add a second indicator like it to the chart. In general, how to make it remove completely from the chart so that I can throw the same indicator on the chart with other values.
Help me fix the indicator. It draws a price step/grid from a specified value. The problem is that when I remove it, the lines remain on the chart. Also, I cannot add a second indicator like it to the chart. In general, how to make it delete completely from the chart, so that it is possible to add the same indicator on the chart with different values.
In OnDeinit you need to doObjectsDeleteAll- delete by prefix (in your case the prefix is "HLine")