Да, программисты, тема ОЧЕНЬ актуальна для меня лично и думаю для МНОГИХ кто управляет приличным числом ордеров на нескольких чартах.
Если кому интересна тема панелей - есть запрос на следующую конфигурацию. Если нужна будет помощь - пишите.
Допустим у меня сейчас открыто 13 счетов с 1000 ордерами на каждом. Итого 13000 ордеров. Естественно сейчас этим добром управляет советник, НО чувствую явную необходимость во всомогательной панели чтобы в ручном режиме вовремя закрывать сетки.
В идеале вижу вариант как на скрине. Также надо сделать ВСЕ возможное для экономии рабочего пространства на графике, поэтому названия кнопочек необходимо сделать как на скрине.
Я не программист, но ЕСЛИ скрипты на отдельное событие (закрытие плюсовых, закрытие минусовых, итд...) помогут, могу выложить мой набор рабочих надежных скриптов.
Кроме того, кто знает что такое функция CloseBY, то могу выложить открытый код по закрытию ордеров с использованием данной функции. Кто знает - понимает МОЩЬ данной функции (молниеносное закрытие, меньшие торговые издержки).
void ReconcileHedgeOrders()
{
for(int i=OrdersTotal()-1;i>0&&!IsStopped();i--)
{
if(OrderSelect(i,SELECT_BY_POS)
&& OrderSymbol()==_Symbol
&& OrderType() && (!m_locked_magic || OrderMagicNumber() == MAGIC)
)
{
int type = OrderType();
int ticket = OrderTicket();
for(int j=i-1;OrderSelect(j,SELECT_BY_POS);j--)
{
if(OrderSymbol()==_Symbol
&& OrderType() && OrderType()!=type
&& (!m_locked_magic || OrderMagicNumber() == MAGIC)
)
{
if(!OrderCloseBy(OrderTicket(),ticket))
Print("OrderCLoseByError: ",GetLastError());
i=OrdersTotal();
break;
}
}
}
}
}
И видео панели на основании скрипта
Описание:
I know, I know... we've all said it before, hedging is f*** stupid because it costs you double in fees, right?
Well that's actually not (always) the case. There's a neat little hidden gem in MT that's almost entirely undocumented and almost never used by developers (ever) that's called OrderCloseBy. What this function does is takes hedged orders and reconciles the transactions as netted. This allows you to do some neat things we'll talk about in a minute, but for now it's important to understand that if you use this method you are not charged double fees since you are instructing the broker server to reconcile the hedge as a netting transaction.
eg. Buy 1 lot to open and Sell 1 lot to close. Profit = spread of sell price - buy price. Net commission = 1 lot (not 2). Net Profit = Profit - commission.
So why is this important? Well it's about risk management. Let's say you have 20 open positions and you want to close them down instantly. How do you do it?
Option 1: Close them one by one whilst crying into your keyboard because your profits are slipping away from waiting for each order to close and confirm....and on......and on........
Option 2: You send in a hedge. Wait until calm markets. Close both and get charged double fees.
Option 3: You send in a hedge. Close whenever you damn-well please by instructing the server to reconcile both transactions as net-closed and only get charged once.
What about reversing positions? Even if you're reversing a single order you still have to close one.........wait for confirmation.........open another. In the mean-time a full second could have passed and massive slippage accrued in the process. Reversing with hedging is instant when you send an order in that's net_position * 2 in the opposite direction. Then of course you use OrderCloseBy to reconcile the orders as partially closed - costing you nothing in the process.
Here is a proof of concept trade panel I made. It's not the prettiest panel out there, but it is the fastest!
IMPORTANT: This will not work with brokers that don't support hedging accounts.
Спасибо )


