zennon писал(а)>> The MovingInWL() function just goes through all open positions, regardless of filters sy,op,mn. This is also true for attached example EA (page 55).
Andrei, thank you! Corrected...
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 23.04.2009 |//| Описание : Перенос уровня стопа в безубыток |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ( "" - любой символ, |//| NULL - текущий символ) |//| op - операция ( -1 - любая позиция) |//| mn - MagicNumber ( -1 - любой магик) |//+----------------------------------------------------------------------------+void MovingInWL(string sy="",int op=-1,int mn=-1){double po, pp;int i, k=OrdersTotal();if( sy=="0") sy=Symbol();for( i=0; i< k; i++){if(OrderSelect( i, SELECT_BY_POS, MODE_TRADES)){if((OrderSymbol()== sy || sy=="")&&( op<0||OrderType()== op)){if( mn<0||OrderMagicNumber()== mn){
po=MarketInfo(OrderSymbol(),MODE_POINT);if(OrderType()==OP_BUY){if(OrderStopLoss()-OrderOpenPrice()< LevelWLoss* po){
pp=MarketInfo(OrderSymbol(),MODE_BID);if( pp-OrderOpenPrice()> LevelProfit* po){
ModifyOrder(-1,OrderOpenPrice()+ LevelWLoss* po,-1);}}}if(OrderType()==OP_SELL){if(OrderStopLoss()==0||OrderOpenPrice()-OrderStopLoss()< LevelWLoss* po){
pp=MarketInfo(OrderSymbol(),MODE_ASK);if(OrderOpenPrice()- pp> LevelProfit* po){
ModifyOrder(-1,OrderOpenPrice()- LevelWLoss* po,-1);}}}}}}}}
Thank you for devoting so much time to the forum. Igor, do you know of an opportunity to get information on incoming buy/sell requests - "market depth".
Question to the experienced: anyone can tell why my demo indicator xMeterMTF.mq4 shows all normal, and in real euro emptiness (whether because of the fact that in real eur/usd- is listed as eur/usddpro) if so can be corrected
This function returns the flag allowing to trade by time. Actually, it actually checks if the current time of the trade server is located inside some time period. If it is inside, the isTradeTimeString() function returns true, otherwise it returns false. The peculiarity of this function is the possibility to specify the time interval both within and outside a day. This will be shown in details in the examples of use. The isTradeTimeString() function accepts the following optional parameters:
TimeBegin - String in the format "HH:MM", it sets the time of trade start. Default value is "00:00".
TimeEnd - String in the format "HH:MM", specifies the trade end time. Default value is "00:00".
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 29.04.2009 |//| Описание : Возвращает флаг разрешения торговли по времени. |//+----------------------------------------------------------------------------+//| Параметры: |//| TimeBegin - время начала торговли (ЧЧ:ММ) |//| TimeEnd - время окончания торговли (ЧЧ:ММ) |//+----------------------------------------------------------------------------+bool isTradeTimeString(string TimeBegin="00:00",string TimeEnd="00:00"){datetime dtBegin, dtEnd;// Время начала и окончания работыint hc, he;// Часы текущего времени и окончания работы
dtBegin=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+ TimeBegin);
dtEnd =StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+ TimeEnd);
hc =TimeHour(TimeCurrent());
he =TimeHour( dtEnd);if( dtBegin>= dtEnd){if( hc>= he) dtEnd+=24*60*60;else dtBegin-=24*60*60;}if(TimeCurrent()>= dtBegin &&TimeCurrent()<= dtEnd)return( True);elsereturn( False);}
This function returns the flag allowing to trade by time. Actually, it actually checks if the current time of the trade server is located inside some time period. If it is inside, the isTradeTimeString() function returns true, otherwise it returns false. The peculiarity of this function is the possibility to specify the time interval both within and outside a day. This will be shown in details in the examples of use. The isTradeTimeString() function accepts the following optional parameters:
TimeBegin - String in the format "HH:MM", it sets the time of trade start. Default value is "00:00".
TimeEnd - String in the format "HH:MM", specifies the trade end time. Default value - "00:00".
It is also possible to set variables to be not "string", but "int". In order to search in the tester?
The MovingInWL() function just goes through all open positions, regardless of filters sy,op,mn. This is also true for attached example EA (page 55).
Andrei, thank you! Corrected...
The e-MovingInWL2.mq4 is also fixed.Good afternoon Igor!
Thank you for devoting so much time to the forum. Igor, do you know of an opportunity to get information on incoming buy/sell requests - "market depth".
Igor, do you know of an opportunity to get information on incoming buy/sell requests - "market depth".
no
The isTradeTimeString() function.
This function returns the flag allowing to trade by time. Actually, it actually checks if the current time of the trade server is located inside some time period. If it is inside, the isTradeTimeString() function returns true, otherwise it returns false. The peculiarity of this function is the possibility to specify the time interval both within and outside a day. This will be shown in details in the examples of use. The isTradeTimeString() function accepts the following optional parameters:
Examples of use of isTradeTimeString().
if (isTradeTimeString("06:00", "09:30")) Message("Торгуем..."); else Message("Отдыхаем...");if (isTradeTimeString("12:00", "16:30")) Message("Торгуем..."); else Message("Отдыхаем...");if (isTradeTimeString("21:15", "09:30")) Message("Торгуем..."); else Message("Отдыхаем...");if (isTradeTimeString("22:00", "05:30")) Message("Торгуем..."); else Message("Отдыхаем...");SZY. Attached is a script to test the isTradeTimeString() function.
Igor, the i-Sessions indicator occasionally has glitches: areas of not yet opened sessions appear and disappear...
Igor, the i-Sessions indicator occasionally has glitches: areas of sessions not yet opened appear and disappear...
Oops... I take that back... They'll come in handy in terms of waiting for events too... Pardon me... please...
The isTradeTimeString() function.
This function returns the flag allowing to trade by time. Actually, it actually checks if the current time of the trade server is located inside some time period. If it is inside, the isTradeTimeString() function returns true, otherwise it returns false. The peculiarity of this function is the possibility to specify the time interval both within and outside a day. This will be shown in details in the examples of use. The isTradeTimeString() function accepts the following optional parameters:
It is also possible to set variables to be not "string", but "int". In order to search in the tester?
>> Thank you in advance.
Can you make variables to be not "string" but "int". To be able to search in the tester?
On page 76...