Hello. Please help. I want to write an EA: If there are no open trades and the open price of the first bar is less than the close price of the first bar and the open price of the second bar is less than the close price of the second bar, then open a deal... But the EA in the tester starts opening deals one after another, I can not understand what is wrong. I CAN NOT UNDERSTAND WHAT IS THE PROBLEM.
int init;
int start()
{
int bar1;
int bar2;
int stoploss=100;
int takeprofit=100;
int slipage=2;
int total;
//-------------------------------------------------------------------+if ( OrdersTotal()<1 && Open[bar1]>Close[bar1] && Open[bar2]>Close[bar2])
{OrderSend("EURUSD",OP_BUY,0.1,Ask,slipage,Ask-stoploss*Point,Ask+takeprofit*Point,"",123,0,Red);}
//-------------------------------------------------------------------+ return;}
Hello. Please help. I want to write an EA: If there are no open trades and the open price of the first bar is less than the close price of the first bar and the open price of the second bar is less than the close price of the second bar, then open a deal... But the EA in the tester starts opening deals one after another, I can not understand what is wrong. I CAN NOT UNDERSTAND WHAT IS THE PROBLEM.
int init;
int start()
{
int bar1;
int bar2;
int stoploss=100;
int takeprofit=100;
int slipage=2;
int total,ticket;
//-------------------------------------------------------------------+if ( OrdersTotal()<1 && Open[bar1]>Close[bar1] && Open[bar2]>Close[bar2])
if(V1()==true)
{
ticket = OrderSend("EURUSD",OP_BUY,0.1,Ask,slipage,Ask-stoploss*Point,Ask+takeprofit*Point,"",123,0,Red);
}
//-------------------------------------------------------------------+ return;}
//+------------------------------------------------------------------+bool V1(){
int i, k=OrdersTotal();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderType()==OP_BUY) {
return(false);
}
}
}
return(true);
}
bool V2(){
int i, k=OrdersTotal();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if(OrderType()==OP_SELL) {
return(false);
}
}
}
return(true);
}
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.
The part is sorted out.
Why does it print zeros when writing bits to an array that is dynamic?
The issue has been resolved. Whoever needs to use it.
How to write data to a dynamic array.
Hello, I trade on Renko chart "RenkoLiveChart_v4.13.mq4".
Can't run or open a trade via EA on offline chart.
Hello, I trade on Renko chart "RenkoLiveChart_v4.13.mq4".
Can't run or open a trade via EA on offline chart.
I have to emulate ticks on offline charts, the terminal does not send tick arrival signal on them.
For example like in this script:
The issue has been resolved. Whoever needs to use it.
How to write data to a dynamic array.
In offline charts it is necessary to emulate ticks, the terminal does not send a signal of a new tick to them.
For example as in this script:
Any other suggestions?
I connect the script to an offline chart, the terminal hangs. May be possible to mount code in robot, then what to do with#import "user32.dll"
Hello. Please help. I want to write an EA: If there are no open trades and the open price of the first bar is less than the close price of the first bar and the open price of the second bar is less than the close price of the second bar, then open a deal... But the EA in the tester starts opening deals one after another, I can not understand what is wrong. I CAN NOT UNDERSTAND WHAT IS THE PROBLEM.
Hello. Please help. I want to write an EA: If there are no open trades and the open price of the first bar is less than the close price of the first bar and the open price of the second bar is less than the close price of the second bar, then open a deal... But the EA in the tester starts opening deals one after another, I can not understand what is wrong. I CAN NOT UNDERSTAND WHAT IS THE PROBLEM.