скрипт от "Хирурга".
//+------------------------------------------------------------------+
//| Zero_Level.mq4 |
//| Copyright © 2007, Xupypr |
//+------------------------------------------------------------------+
// Скрипт вычисляющий уровни без убытка, на покупку, на продажу с учетом накопленных свопов.
#property copyright "Copyright © 2007, Xupypr"
#include <WinUser32.mqh>
void start()
{
double BuyLots=0;
double SellLots=0;
double BuyProfit=0;
double SellProfit=0;
int Total=OrdersTotal();
for (int i=Total-1;i>=0;i--)
{
if (OrderSelect(i,SELECT_BY_POS))
{
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_BUY)
{
BuyLots=BuyLots+OrderLots();
BuyProfit=BuyProfit+OrderProfit()+OrderCommission()+OrderSwap();
}
if (OrderType()==OP_SELL)
{
SellLots=SellLots+OrderLots();
SellProfit=SellProfit+OrderProfit()+OrderCommission()+OrderSwap();
}
}
}
double Price=0;
double TickValue=MarketInfo(Symbol(),MODE_TICKVALUE);
if (BuyLots>0) double BuyLevel=NormalizeDouble(Bid-(BuyProfit/(TickValue*BuyLots)*Point),Digits); else BuyLevel=0;
if (SellLots>0) double SellLevel=NormalizeDouble(Ask+(SellProfit/(TickValue*SellLots)*Point),Digits); else SellLevel=0;
if ((BuyLots-SellLots)>0) Price=NormalizeDouble(Bid-((BuyProfit+SellProfit)/(TickValue*(BuyLots-SellLots))*Point),Digits);
if ((SellLots-BuyLots)>0) Price=NormalizeDouble(Ask+((BuyProfit+SellProfit)/(TickValue*(SellLots-BuyLots))*Point),Digits);
string Title="Уровень без убытка для "+Symbol();
string ZeroLevel=" не существует";
if (Price>0) ZeroLevel=" = "+DoubleToStr(Price,Digits);
string Buy=" не существует";
if (BuyLevel>0) Buy=" = "+DoubleToStr(BuyLevel,Digits);
string Sell=" не существует";
if (SellLevel>0) Sell=" = "+DoubleToStr(SellLevel,Digits);
string Message="Уровень без убытка"+ZeroLevel+"\t\nУровень на покупку"+Buy+"\t\nУровень на продажу"+Sell;
MessageBox(Message,Title,MB_OK|MB_ICONINFORMATION);
}