All these conditions may not follow immediately one after another (may be in an hour or two or three), therefore we should make it so that as soon as the indicator reaches 1.0000, this condition is not checked at every tick, and wait until one bar closes with fall, and after that these 2 conditions are not checked at every tick, and wait until the indicator reaches 0.9980 or equal. As soon as all conditions are fulfilled we open a market order to sell 0.1 lot with a stop loss of 400p and take profit of 400p.
In general it's OK, but I would pay close attention to the values returned by the indicator.
bool Val_max=false, Cl_dn=false, Val_min=false;
//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+int start()
{
int
i, j, total,
cnt,
OrderBuy,
OrderSell,
Magic,
Ticket, // Номер ордера
Total=0, // Количество ордеров в окне
Tip=-1; // Тип выбран. ордера (B=0,S=1) double
Open_0,
ask,
bid,
Price, // Цена выбранного ордера
SL, // SL выбранного ордера
TP, // TP выбранного ордера
Lot; // Колич. лотов в выбран.ордере
Open_0=Open[0]; // Цена откр. формирующегося бара
ask=Ask; // Текущая цена покупки
bid=Bid; // Текущая цена продажиstring
Symb; // Название финанс. инструмента
Symb=Symbol(); // Название фин.инстр.double Value_max=1.0000;
double Value_min=0.9980;
double Open_1= Open[1];
double Close_1= Close[1];
//----//--------------------------------------------------------------- 4 --double Val=iCustom(NULL, 0, "HMR MULTI Indicator",0,0);
if (Val >= Value_max) Val_max=true; // if (Open_1 > Close_1 && Val_max==true) Cl_dn=true;
if (Val <= Value_min && Cl_dn==true) Val_min=true;
if (Val_max==true && Cl_dn==true && Val_min==true)
{
for (j = 0; j < OrdersTotal(); j++)
{
OrderSelect(j, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol())
{
if (OrderType() == OP_SELL) return(0);
}
}
OrderSend(Symbol(),OP_SELL,0.1,NormalizeDouble(Bid,Digits),2,Bid+400*Point,Bid-400*Point,"",3,Red); // Открытие SELL
Val_max=false; Cl_dn=false; Val_min=false;
}
//----return(0);
}
1. You may need to disconnect MT4 from the internet and then import historical data.
2. You need to check the code.
... indicator.
int start(){
double Val=iCustom(NULL, 0, "HMR MULTI Indicator",0,0);
Alert(Val);
}
Try the "gut feeling" method with an empty Expert Advisor,
verify in the indicator that ObjectCreate finds its subwindow (or why draw it IF we test OR OPTIMIZE it)
if(IsTesting()||IsOptimization())флаг_Канады_не_рисовать_obj=true; //проверяем надо ли рисовать (в ините ему место через статик переменную)
if(!флаг_Канады_не_рисовать_obj){ //запрет отрисовки объектов ели оптимизация или тестирование
ObjectCreate(........................);
}
Can you please tell me how to prevent the EA from writing repetitions to the file using the "Tool" parameter (_OrderSymbol). I've seen on the forum how to delete repetitions https://forum.mql4.com/ru/5814 in an array, but I haven't figured out how to apply it to my situation. And with repeats it starts stamping 200 identical lines into a file even in one loop.
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.
Better still the first option, place before attempting to open an order (OrderSend)
All these conditions may not follow immediately one after another (may be in an hour or two or three), therefore we should make it so that as soon as the indicator reaches 1.0000, this condition is not checked at every tick, and wait until one bar closes with fall, and after that these 2 conditions are not checked at every tick, and wait until the indicator reaches 0.9980 or equal. As soon as all conditions are fulfilled we open a market order to sell 0.1 lot with a stop loss of 400p and take profit of 400p.
In general it's OK, but I would pay close attention to the values returned by the indicator.
Overall it's OK, but I would pay close attention to the values returned by the indicator.
When the value reached 1.0000, at each tick the following message was displayed: " Indicator value >= 1.0000".Tried in real time via Alert the value of the indicator, the message was displayed normally:
Tried the real time value of the indicator via Alert, the message was displayed normally:
Then what the tester doesn't like, you need to add alerts and look in the logbook.
Well is the code correct?
What does it mean?
2011.12.06 01:07:55 HMR MULTI Indicator EURUSD,M15: removed
2011.12.06 01:07:57 TestGenerator: unmatched data error (volume limit 603 at 2011.12.01 00:00 exceeded)
2011.12.06 01:07:57 2011.12.01 00:00 HMR MULTI Indicator EURUSD,M15: unknown subwindow number -1 for ObjectCreate function
What does it mean?
2011.12.06 01:07:55 HMR MULTI Indicator EURUSD,M15: removed
2011.12.06 01:07:57 TestGenerator: unmatched data error (volume limit 603 at 2011.12.01 00:00 exceeded)
2011.12.06 01:07:57 2011.12.01 00:00 HMR MULTI Indicator EURUSD,M15: unknown subwindow number -1 for ObjectCreate function
... indicator.
Try the "gut feeling" method with an empty Expert Advisor,
verify in the indicator that ObjectCreate finds its subwindow (or why draw it IF we test OR OPTIMIZE it)
That is, if there is no parameter transfer, then:
Thank you for your answers !
Good afternoon!
Can you please tell me how to prevent the EA from writing repetitions to the file using the "Tool" parameter (_OrderSymbol). I've seen on the forum how to delete repetitions https://forum.mql4.com/ru/5814 in an array, but I haven't figured out how to apply it to my situation. And with repeats it starts stamping 200 identical lines into a file even in one loop.