Einzelnen Beitrag anzeigen
  #4 (permalink)  
Alt 25.02.14
steve468 steve468 ist offline
Neues Mitglied
 
Registriert seit: Mar 2013
Beiträge: 19
steve468 befindet sich auf einem aufstrebenden Ast
Standard

Also für Breakeven wirst Du sicher im Netz was finden.
Sieht in etwa so aus :

void MoveBreakEven()
{
int cnt,total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL&&OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY)
{
if(BreakEven>0)
{
if(NormalizeDouble((Bid-OrderOpenPrice()),Digits)>BreakEven*Point)
{
if(NormalizeDouble((OrderStopLoss()-OrderOpenPrice()),Digits)<0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Normali zeDouble(OrderOpenPrice()+0*Point,Digits),OrderTak eProfit(),0,Blue);
return(0);
}
}
}
}
else
{
if(BreakEven>0)
{
if(NormalizeDouble((OrderOpenPrice()-Ask),Digits)>BreakEven*Point)
{
if(NormalizeDouble((OrderOpenPrice()-OrderStopLoss()),Digits)<0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Normali zeDouble(OrderOpenPrice()-0*Point,Digits),OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
}

Und für TrailingStep etwa so:

void TrailingPositions(int trailingStopLoss, int trailingStep, int magicNumber) {
double bid = 0;
double ask = 0;
for (int i = 0; i < OrdersTotal(); i++) {
if (!(OrderSelect(i, SELECT_BY_POS)) || OrderSymbol() != Symbol() || OrderMagicNumber() != magicNumber) {
continue;
}

bid = MarketInfo(OrderSymbol(), MODE_BID);
ask = MarketInfo(OrderSymbol(), MODE_ASK);

if (OrderType() == OP_BUY) {
if (bid - OrderOpenPrice() > trailingStopLoss * Point) {
if (OrderStopLoss() < bid - (trailingStopLoss + trailingStep) * Point || OrderStopLoss() == 0) {
OrderModify(OrderTicket(), OrderOpenPrice(), bid - trailingStopLoss * Point, OrderTakeProfit(), OrderExpiration());

}
}
} else if (OrderType() == OP_SELL) {
if (OrderOpenPrice() - ask > trailingStopLoss * Point) {
if (OrderStopLoss() > ask + (trailingStopLoss + trailingStep) * Point || OrderStopLoss() == 0) {
OrderModify(OrderTicket(), OrderOpenPrice(), ask + trailingStopLoss * Point, OrderTakeProfit(), OrderExpiration());

}
}
}
}
}

Falls Du hilfe brauchst, dann gib bescheid.