Почему не спросить у оффициалов?
robotforexpro.com
Если у них покупали, то возможно и дадут мт5
OnTick
{
if(previousBar!=Time[0])
{
previousBar=Time[0];
}
else
{
return;
}
}
<code>if(t!=Time[0] && TimeSession(StartHour,StartMin,StopLoss,StopLoss,TimeCurrent())) { if(buy && CountTrades(0)<1) { PutOrder(0,Ask); } if(sell && CountTrades(1)<1) { PutOrder(1,Bid); } ModifyOrders(); t=Time[0]; } </code>
double totalProfitPercentage = 0.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_SELL)
{
totalProfitPercentage += OrderProfit() / AccountBalance() * 100.0;
}
}
}
}
if (totalProfitPercentage >= targetProfitP)
{
CloseAllOrdersIfProfitReached(targetProfitP);
}
double profit = 0;
profit = OrderProfit() + OrderSwap() + OrderCommission();
void CloseAllOrdersIfProfitReached(double totalProfitP)
{
double accountBalance = AccountBalance();
double targetProfit = accountBalance * (totalProfitP / 100.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_SELL)
{
double orderProfit = OrderProfit();
targetProfit -= orderProfit;
if (targetProfit <= 0)
{
if (OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), Slippage, clrRed))
{
Print("Order closed: ", OrderTicket());
}
else
{
Print("Failed to close order: ", OrderTicket(), ", Error: ", GetLastError());
}
}
}
}
}
}
}
← предыдущая следующая →
kasparsvas16