Please don't create topics randomly in any section. It has been moved to the section: Expert Advisors and Automated Trading
Please EDIT your post and use the CODE button (Alt-S) when inserting code.
Hover your mouse over your post and select "edit" ...
Fernando Carreiro #:
Please don't create topics randomly in any section. It has been moved to the section: Expert Advisors and Automated Trading
Please EDIT your post and use the CODE button (Alt-S) when inserting code.
Hover your mouse over your post and select "edit" ...
well, I didn't know, thanks for the information
I am tryng this but not work... help please
enum OrderType { BUY, SELL, BUY_STOP, BUY_LIMIT, SELL_STOP, STOP_LIMIT, }; Void Ontick() { Print("Atualizando"); CopyBuffer(handlevaria, 0, 0, 5, S3S); CopyBuffer(handlevaria, 1, 0, 5, S2S); CopyBuffer(handlevaria, 2, 0, 5, S1S); CopyBuffer(handlevaria, 3, 0, 5, fec); CopyBuffer(handlevaria, 4, 0, 5, S1I); CopyBuffer(handlevaria, 5, 0, 5, S2I); CopyBuffer(handlevaria, 6, 0, 5, S3I); Print(S3S[0]); Print(S2S[0]); Print(S1S[0]); Print(fec[0]); Print(S1I[0]); Print(S2I[0]); Print(S3I[0]); Print(""); } // Verifica se já existe uma ordem no mesmo nível de preço int totalOrders = OrdersTotal(); for (int i = 0; i < totalOrders; i++) { // Obtém o ticket e o preço de abertura de cada ordem ulong ticket = OrderGetTicket(i); double openPrice = OrderGetDouble(ORDER_PRICE_OPEN); // Obtém o tipo da ordem int orderType = (int)OrderGetInteger(ORDER_TYPE); // Verifica se o preço de abertura e o tipo de ordem são iguais if ((openPrice == S3S[0] || openPrice == S2S[0] || openPrice == S1S[0] || openPrice == fec[0] || openPrice == S1I[0] || openPrice == S2I[0] || openPrice == S3I[0] || ) && orderType == ORDER_TYPE) { // Já existe uma ordem no mesmo nível de preço com o mesmo tipo // Faça alguma ação aqui, como exibir uma mensagem de erro ou ignorar a criação da ordem m_trade.OrderDelete(ticket); Print("ordem deletada",ticket); return; } } or Void Ontick() { // Verifica se já existe uma ordem no mesmo nível de preço int totalOrders = OrdersTotal(); for (int i = 0; i < totalOrders; i++) { // Obtém o ticket e o preço de abertura de cada ordem ulong ticket = OrderGetTicket(i); double openPrice = OrderGetDouble(ORDER_PRICE_OPEN); //double PositionPrice= POSITION_PRICE_OPEN //OrderSelect(ticket); if(ORDER_TYPE_BUY_STOP) // if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic) // Compara o preço de abertura da ordem com o preço desejado para a nova ordem if (openPrice == S3S[0] || openPrice == S2S[0] || openPrice == S1S[0] || openPrice == fec[0] || openPrice == S1I[0] || openPrice == S2I[0] || openPrice == S3I[0]) { m_trade.OrderDelete(ticket); Print("ordem deletada",ticket); return; } if(ORDER_TYPE_BUY_LIMIT) //if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic) // Compara o preço de abertura da ordem com o preço desejado para a nova ordem if (openPrice == S3S[0] || openPrice == S2S[0] || openPrice == S1S[0] || openPrice == fec[0] || openPrice == S1I[0] || openPrice == S2I[0] || openPrice == S3I[0]) { m_trade.OrderDelete(ticket); Print("ordem deletada",ticket); return; if(ORDER_TYPE_SELL_LIMIT) //if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic) // Compara o preço de abertura da ordem com o preço desejado para a nova ordem if (openPrice == S3S[0] || openPrice == S2S[0] || openPrice == S1S[0] || openPrice == fec[0] || openPrice == S1I[0] || openPrice == S2I[0] || openPrice == S3I[0]) { m_trade.OrderDelete(ticket); Print("ordem deletada",ticket); return; } if(ORDER_TYPE_SELL_STOP) //if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic) // Compara o preço de abertura da ordem com o preço desejado para a nova ordem if (openPrice == S3S[0] || openPrice == S2S[0] || openPrice == S1S[0] || openPrice == fec[0] || openPrice == S1I[0] || openPrice == S2I[0] || openPrice == S3I[0]) { m_trade.OrderDelete(ticket); Print("ordem deletada",ticket); return; } if((ORDER_TYPE_BUY) || (POSITION_TYPE_BUY)) //if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic) // Compara o preço de abertura da ordem com o preço desejado para a nova ordem if (openPrice == S3S[0] || openPrice == S2S[0] || openPrice == S1S[0] || openPrice == fec[0] || openPrice == S1I[0] || openPrice == S2I[0] || openPrice == S3I[0]) { m_trade.OrderDelete(ticket); Print("ordem deletada",ticket); return; } if((ORDER_TYPE_SELL)|| (POSITION_TYPE_SELL)) //if(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic) // Compara o preço de abertura da ordem com o preço desejado para a nova ordem if (openPrice == S3S[0] || openPrice == S2S[0] || openPrice == S1S[0] || openPrice == fec[0] || openPrice == S1I[0] || openPrice == S2I[0] || openPrice == S3I[0]) { m_trade.OrderDelete(ticket); Print("ordem deletada",ticket); return; }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
1 for when the pending order is executed but not completed
Repeated pending orders at the same price level after the next day
using an indicator with double variables and predefined buffers
appointments are renewed the next day or at predefined times