Karputov Vladimir: Not possible due to the fact that in case of ftp network delays, the indicator may slow down the entire terminal. But from the EA, you are welcome to do so.
Hi all. I am writing my first EA and I'm facing a problem I can't win.
voidOnTick()
{
datetime EaStartTime = StringToTime(StartTime); // время начала работы советникаdatetime EaEndTime = StringToTime(EndTime); // время окончания работы советникаdatetime CurrTime = TimeCurrent(); // это если нужно взять время терминалаif (CurrTime < EaStartTime || CurrTime >= EaEndTime)
return; // если еще не время торговать - выход
{
PriceLow=iEnvelopes(NULL,0,MA_Period,MA_Shift,MA_Method,Applied_Price,Deviation,0,1);
PriceHigh =iEnvelopes(NULL,0,MA_Period,MA_Shift,MA_Method,Applied_Price,Deviation,1,1);
MacdCurrent=iMACD(NULL,0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_MAIN,0);
SignalCurrent=iMACD(NULL,0,InpFastEMA,InpSlowEMA,InpSignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
SignalMAPrevious=iMA(NULL,0,InpMAPeriod,InpMAShift,InpMAMethod,PRICE_MEDIAN,1);
SignalMAThis=iMA(NULL,0,InpMAPeriod,InpMAShift,InpMAMethod,PRICE_MEDIAN,0);
PriceCurrentOpen=iOpen(NULL,0,1);
PriceCurrentClose=iClose(NULL,0,1);
if (CountTrades()==0) CheckForOpen();
else
{
if(CountTrades()<max_trades) CheckForOpen();
}
}
}
void CheckForOpen()
{
//-----Ставим ордер на покупку.if(PriceCurrentOpen<PriceLow&&PriceCurrentOpen<PriceCurrentClose&&SignalCurrent<MacdCurrent&&SignalMAPrevious<SignalMAThis)
{
ticket=OrderSend(NULL,OP_BUY,Lots,Ask,slippage,0,0,"5",magic,0,Blue);
if(ticket>0)
return;
}
//-----Ставим ордер на продажу.if(PriceCurrentOpen>PriceLow&&PriceCurrentOpen>PriceCurrentClose&&SignalCurrent>MacdCurrent&&SignalMAPrevious>SignalMAThis)
{
ticket=OrderSend(NULL,OP_SELL,Lots,Bid,slippage,0,0,"5",magic,0,Red);
if(ticket>0)
return;
}
}
My EA should give a buy and sell signal if the previous bar was opened outside the channel"Envelopes",if it was above the channel, then sell, if it was below buy, but in fact it always sends orders when it feels like, it may go long inside the channel and suddenly start buying orders, although all the other conditions are ok, if the sell signal sells and buy, buy.
How to make him buy one order per bar, rather than all at once allowed number of orders every second?
Hi all. I am writing my first EA and I'm facing a problem I can't win.
My EA should give a buy and sell signal if the previous bar was opened outside the channel"Envelopes",if it was above the channel, then sell, if it was below buy, but in fact it always sends orders when it feels like, it may go long inside the channel and suddenly start buying orders, although all the other conditions are ok, if the sell signal sells and buy, buy.
How to make him buy one order per bar, rather than all at once allowed number of orders every second?
Good day. Before sending an order, check if you already have open positions. If there are any, do not send an order to open, otherwise send it. As far as I understand your code, this function CountTrades() deals with it. So, check values returned by this function.
Until yesterday one order was opened and the next one will not open until the next order is opened, but how to make my EA open the orders when the previous bar was above (below) the channel?
Nickolay72: Until yesterday I had one order each, and while there is an order, the next one will not open.How to make my EA open orders according to the order when the previous bar has opened above (below) the channel? Right now, most of the orders are losing, because they are not opened according to the conditions.
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.
Vladimir, thank you for your patience and help!
Really made a mistake in the code ...
I'll be more careful from now on.
Good afternoon.
Please advise how to solve the problem. When trying to send a file with SendFTP() there is a 4014 error - System function is not allowed to be called.
The FTP settings are OK - reports and test file are sent.
Thank you in advance.
Good afternoon.
Please advise how to solve the problem. When trying to send a file with SendFTP() there is a 4014 error - System function is not allowed to be called.
The FTP settings are OK - reports and test file are sent.
Thank you in advance.
Are you by any chance trying to send from an indicator?
Accidentally yes... Why can't you?
Not possible due to the fact that in case of ftp network delays, the indicator may slow down the entire terminal. But from the EA, you are welcome to do so.
Hi all. I am writing my first EA and I'm facing a problem I can't win.
My EA should give a buy and sell signal if the previous bar was opened outside the channel"Envelopes",if it was above the channel, then sell, if it was below buy, but in fact it always sends orders when it feels like, it may go long inside the channel and suddenly start buying orders, although all the other conditions are ok, if the sell signal sells and buy, buy.
How to make him buy one order per bar, rather than all at once allowed number of orders every second?
Hi all. I am writing my first EA and I'm facing a problem I can't win.
My EA should give a buy and sell signal if the previous bar was opened outside the channel"Envelopes",if it was above the channel, then sell, if it was below buy, but in fact it always sends orders when it feels like, it may go long inside the channel and suddenly start buying orders, although all the other conditions are ok, if the sell signal sells and buy, buy.
How to make him buy one order per bar, rather than all at once allowed number of orders every second?
Until yesterday I had one order each, and while there is an order, the next one will not open.How to make my EA open orders according to the order when the previous bar has opened above (below) the channel? Right now, most of the orders are losing, because they are not opened according to the conditions.