Questions from Beginners MQL5 MT5 MetaTrader 5 - page 593 1...586587588589590591592593594595596597598599600...1605 New comment mila.com 2016.06.13 03:55 #5921 Hello. Can you please tell me how to calculate the number of losing positions closed in a row. When trading binary options in MT4 at Grand K broker. The normal function doesn't count, this one does: int CountLoss() { int count=0; for(int trade=OrdersHistoryTotal()-1;trade>=0; trade--) { OrderSelect(trade,SELECT_BY_POS,MODE_HISTORY); if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) { if(OrderProfit()<0) count++; else break; } } return(count); } On the commentary, it doesn't work either. Comments are strange in history snapshot here Any questions from newcomers [WARNING CLOSED!] Any newbie Identifying trades from various Arseniy Barudkin 2016.06.13 04:10 #5922 Alexander Antoshkin: How do I check for a pending order?In the open position optionwe look atif(ePositionType == POSITION_TYPE_BUY)if(ePositionType == POSITION_TYPE_SELL)but what about the pending//+------------------------------------------------------------------+ // Количество открытых отложенных ордеров int CountTrades() { int count = 0; for(int i = OrdersTotal()-1; i>=0; i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) { if(OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP) count++; } } } return(count); } //+------------------------------------------------------------------+ Returns number of pending orders Alexey Viktorov 2016.06.13 07:45 #5923 Alexander Antoshkin: How do I check for a pending order?In the open position optionwe look atif(ePositionType == POSITION_TYPE_BUY)if(ePositionType == POSITION_TYPE_SELL)and what about the pendingPositions and orders should not be confused in mql5. Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров www.mql5.com Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5 [Deleted] 2016.06.13 11:44 #5924 Alexey Viktorov: In mql5 you should not confuse positions and orders.I have found two solutions to the problem1.I assigned a comment to the orders in the request, oRequest.comment = "LimitSell"; oRequest.comment = "LimitBuy";in a globalstring comment ="";I came up with this variantif(OrderGetString(ORDER_COMMENT)=="LimitSell")if(OrderGetString(ORDER_COMMENT)=="LimitBuy")I don't know if this is right, but it seems to work2. You can do it without commentsif(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY_LIMIT) .... Beta Testing of MetaTrader How to program that Questions from Beginners MQL4 Alexey Viktorov 2016.06.13 12:01 #5925 Alexander Antoshkin:2. You can do without commentsif(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY_LIMIT) .... This is exactly what I was talking about. bv1979 2016.06.13 14:25 #5926 Hello, how do I put a trailing stop into an EA in mt5? Vladimir Karputov 2016.06.13 14:29 #5927 bv1979: Hello, how do I put a trailing stop into an EA in mt5? The default EA comes with ...\MQL5\Experts\Examples\MACD\MACD Sample.mq5. Look at the function implementation ****Modified. Vyacheslav Kornev 2016.06.13 20:13 #5928 can you advise me on where to find such an advisor?Grid, open positions only one way, Martin, close the previous position by tp or sl with opening the next one (increased if closed by sl) Vladimir Karputov 2016.06.13 20:16 #5929 Slava_kornev55:can you advise me on where to find such an EA?Grid, open positions only one way, Martin, close the previous position by tp or sl with opening the next one (increased if closed by sl) Search in the upper right corner of the site (magnifying glass) is all searchable. Vyacheslav Kornev 2016.06.13 21:16 #5930 Karputov Vladimir: A search in the top right-hand corner of the website (magnifying glass) will find everything. I didn't find one 1...586587588589590591592593594595596597598599600...1605 New comment
Hello.
Can you please tell me how to calculate the number of losing positions closed in a row.
When trading binary options in MT4 at Grand K broker.
The normal function doesn't count, this one does:
On the commentary, it doesn't work either.
Comments are strange in history snapshot here
How do I check for a pending order?
In the open position option
we look at
if(ePositionType == POSITION_TYPE_BUY)
if(ePositionType == POSITION_TYPE_SELL)
but what about the pending
How do I check for a pending order?
In the open position option
we look at
if(ePositionType == POSITION_TYPE_BUY)
if(ePositionType == POSITION_TYPE_SELL)
and what about the pending
Positions and orders should not be confused in mql5.
In mql5 you should not confuse positions and orders.
I have found two solutions to the problem
1.
I assigned a comment to the orders in the request, oRequest.comment = "LimitSell"; oRequest.comment = "LimitBuy";
in a global
string comment ="";
I came up with this variant
if(OrderGetString(ORDER_COMMENT)=="LimitSell")
if(OrderGetString(ORDER_COMMENT)=="LimitBuy")
I don't know if this is right, but it seems to work
Hello, how do I put a trailing stop into an EA in mt5?
can you advise me on where to find such an advisor?
Grid, open positions only one way, Martin, close the previous position by tp or sl with opening the next one (increased if closed by sl)
can you advise me on where to find such an EA?
Grid, open positions only one way, Martin, close the previous position by tp or sl with opening the next one (increased if closed by sl)
A search in the top right-hand corner of the website (magnifying glass) will find everything.