[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 477

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
demlin:
Еще вопрос: какой функцией можно вытащить стоимость одного пункта инструмента?
https://docs.mql4.com/ru/constants/marketinfo
MarketInfo(Symbol(), MODE_TICKVALUE);
Please tell me which code should be written in the EA to make the EA trade only once an hour
For example, the EA has triggered, an order is opened (not interested in further), I would like the order not to open on the current bar on an hour timeframe
it all looks alike:
int hh;
int CurrentHour;
CurrentHour=TimeHour(TimeCurrent());
if (CurrentHour!=hh)
{
OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Bid-3*Point,Bid+3*Point);
hh=TimeHour(TimeCurrent());
}
but I have countless orders open
Hello all!
Please tell me what this means:
Order buy ...... failed [Trade timeout]
I am specifically interested in what kind of timeout it is.
https://www.mql5.com/ru/forum/112612
This is an expired server response --- whether the deal opened or not. And there is no guarantee that the trade did not open.
So, I have to check if order is opened in a minute and then continue trading.
rlx:
needs to be set before start() and init()
int hh = 0;
int init()
{
return(0);
}
int start()
{
//-------------------------------------------------
int countorder;
countorder=OrdersTotal();
if (countorder==0)
{
Alert ("no open orders");
}else
{
Alert ("have open orders");
}
int hh;
int CurrentHour;
CurrentHour=TimeHour(TimeCurrent());
if ((CurrentHour!=h)&&(countorder==0))
{
OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Bid-3*Point,Bid+3*Point);
hh=TimeHour(TimeCurrent());
}
//-------------------------------------------------
return(0);
}
int deinit()
{
return(0);
}
I did as you said, no effect, added count of open orders, now opens orders right after close
I worked around it via OrderCloseTime() - it seems to work now
int countorder;
countorder=OrdersTotal();
if (countorder==0)
{
Alert ("no open orders");
}else
{
Alert ("have open orders");
}
int hh;
int CurrentHour;
int LastOrderCloseTime;
CurrentHour=TimeHour(TimeCurrent());
OrderSelect(HistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY);
hh=TimeHour(OrderCloseTime());
if ((CurrentHour!=hh)&&(countorder==0))
{
OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Bid-3*Point,Bid+3*Point);
}
https://www.mql5.com/ru/forum/112612
This is the waiting period for the server to respond --- whether a trade has opened or not. And there is no guarantee that the deal has not opened.
Therefore, as recommended by the developers, check after one minute whether an order has opened and only then proceed.
I don't want to be a pain in the ass, however.
Explain to me how an order will open if OrderTotal() is zero.
Thank you.
Below is the figure with brackets limiting the block of code that is executed under the condition
OrderSend() operations are not affected by this condition.
how to get a bar number, in the "future" :)
iBarShift() works fine to get the bar number from the history, but how would you get the bar number for this code if you move the line to the right - beyond the zero bar?
how to get a bar number, in the "future" :)
iBarShift() works fine for getting the bar number from the history, but how can I get the bar number for this code if I shift the line to the right - beyond the zero bar?
You can get an offset relative to Time[0]
You can get an offset relative to Time[0]
Thank you! Everything is OK now!