so.... 2ter versuch
ich brauche einfach nur einen BreakEven, der einmal ordermodify macht.
z.z. macht er immer noch trailing, das heisst, er macht alle breakevenpoint eine neue ordermodify
auf der shortseite macht er garnichts...???
keine Ahnung warum
hier der code
Code:
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == ~OrderId~)
{
if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > ~BreakEvenPoint~*PipValue*Point && (OrderStopLoss() < Ask-(~BreakEvenPoint~+~TrailingGap~)*PipValue*Point))
{
bool ret1 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask-~TrailingGap~*PipValue*Point, OrderTakeProfit(), OrderExpiration(), ~Color~);
if (ret1 == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > ~BreakEvenPoint~*PipValue*Point && (OrderStopLoss() > Bid+(~BreakEvenPoint~+~TrailingGap~)*PipValue*Point))
{
bool ret2 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid+~TrailingGap~*PipValue*Point, OrderTakeProfit(), OrderExpiration(), ~Color~);
if (ret2 == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
else
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
~next~