Question: who has this EA opening both Buy and Sell orders? Or maybe I'm misunderstanding something, but I'm getting error 138. https://www.mql5.com/ru/code/8177
Could you advise how to loop the execution of the entire program? Preferably not an eternal loop, but the execution of the program a certain number of times. Here is a simple example -
bool Log=false;
int start()
{
if(Log==false) int tick=OrderSend("GBPUSD",OP_BUY,0.01,Ask,3,Bid-30*Point,Bid+30*Point);
Log = true;
return;
}
How do I place the loop statement so that when a stop order triggers, the same (for example) position is opened immediately?
cycles are unnecessary, the program is already looped to be called at every tick. Remember the order ticket and then check OrderCloseTime() every time. If it is not 0, it means that the order has closed. How exactly - at take or stop - you can find out by analyzing OrderProfit().
alsu>>: циклов не надо, программа и так зациклена на вызов при каждом тике. Запомните тикет ордера, а потом проверяйте каждый раз OrderCloseTime(). Если оно не 0, значит ордер закрылся. Как именно - по тейку или стопу - можно узнать, проанализировав OrderProfit().
Lim1>>: Подскажите как зациклить выполнение всей программы? Желательно не вечный цикл, а выполнение программы определенное количество раз. Вот простой пример -
bool Log=false;
int start()
{
if(Log==false) int tick=OrderSend("GBPUSD",OP_BUY,0.01,Ask,3,Bid-30*Point,Bid+30*Point);
Log = true;
return;
}
Как расположить оператор цикла чтобы при срабатывании стоп приказа сразу происходило бы открытие этой же (например) позиции?
Not quite clear, paraphrase.
int start()
{
for(int i = 0; i < 15; i++){
bool покупать=false,
продавать=false;
string Symbol_="GBPJPY";
if(iRSI(Symbol_,5,144,0,1)>50)
покупать=true;
else
продавать=true;
if(покупать)
int tick=OrderSend(Symbol_,OP_BUY,0.01,Ask,3,Bid-30*Point,Bid+30*Point);
if(продавать)
int tick=OrderSend(Symbol_,OP_SELL....................................);
Sleep(100);//0.1 sec/ ждем
}
return(0);
}
A good code will open fifteen orders in a second and a half depending on RSI readings. It is better to describe in words what you want to get and not to refer to cycles and all that. For example to open one order by RSI reading, if it will be closed by stop, immediately open the next one, etc.
splxgf>>: Хороший код, за полторы секунды откроет пятнадцать ордеров в зависимости от показаний RSI. Лучше описать словами то что хочется получить и не надо ссылаться на циклы и все такое. к примеру открыть один ордер по показаниям RSI, если он будет закрыт по стопу сразу открыть следующий и т.п.
=))
Can you tell me how to loop the execution of an entire program? Preferably not an eternal loop, but to execute the program a certain number of times. Here's a simple example -
Question: who has this EA opening both Buy and Sell orders?
Or maybe I'm misunderstanding something, but I'm getting error 138.
https://www.mql5.com/ru/code/8177
For five digits, the slippage must be increased
>> Thank you. Now I see why it used to work and now it doesn't. I didn't think of that.Preferably not an eternal loop, but the execution of the program a certain number of times.
Here is a simple example -
int tick=OrderSend("GBPUSD",OP_BUY,0.01,Ask,3,Bid-30*Point,Bid+30*Point);
How do I place the loop statement so that when a stop order triggers, the same (for example) position is opened immediately?
циклов не надо, программа и так зациклена на вызов при каждом тике. Запомните тикет ордера, а потом проверяйте каждый раз OrderCloseTime(). Если оно не 0, значит ордер закрылся. Как именно - по тейку или стопу - можно узнать, проанализировав OrderProfit().
What if the stop was at breakeven, etc.?
а если стоп стоял в безубытке и т.п.?
If only mushrooms could grow in your mouth.
если б да кабы, да во рту росли б грибы.
Can't you think of anything cleverer? Answer the question properly.
Подскажите как зациклить выполнение всей программы?
Желательно не вечный цикл, а выполнение программы определенное количество раз.
Вот простой пример -
int tick=OrderSend("GBPUSD",OP_BUY,0.01,Ask,3,Bid-30*Point,Bid+30*Point);
Как расположить оператор цикла чтобы при срабатывании стоп приказа сразу происходило бы открытие этой же (например) позиции?
Not quite clear, paraphrase.
Не совсем понятно, перефразируйте.
It is better to describe in words what you want to get and not to refer to cycles and all that. For example to open one order by RSI reading, if it will be closed by stop, immediately open the next one, etc.
Хороший код, за полторы секунды откроет пятнадцать ордеров в зависимости от показаний RSI.
Лучше описать словами то что хочется получить и не надо ссылаться на циклы и все такое. к примеру открыть один ордер по показаниям RSI, если он будет закрыт по стопу сразу открыть следующий и т.п.
=))
I don't mind, I don't mind.
I agree "Better described in words"!