#property copyright "Copyright © 2010, VIKRAV" #property link "http://www.vikrav.com" string gs76 = "BreakEven"; extern int LockInPipsAt = 40; extern int LockInPips = 2; extern int LockInPipsAt1 = 40; extern int LockInPips1 = 2; int Trades = 1; bool ModifyTrades = TRUE; bool ModifyTrade3 = TRUE; int FontSize = 8; color FontColour = White; double gdunused112; double gd120; double gd128; string gs144 = "expert.wav"; string gsdummy152; int gi160 = 3; int gslippage164 = 0; int gi168 = 0; int init() { gd120 = Point; gdunused112 = Digits; gslippage164 = gi160; if (Digits == 5 || Digits == 3) { gdunused112 = Digits - 1; gd120 = 10.0 * Point; gslippage164 = 10 * gi160; } if (NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2) == 0.01) gi168 = 2; else gi168 = 1; return (0); } int deinit() { ObjectDelete("EA_Version"); ObjectDelete("Monitor1"); ObjectDelete("Monitor2"); ObjectDelete("Monitor3"); return (0); } int start() { if (Digits == 5 || Digits == 3) gd128 = MarketInfo(Symbol(), MODE_SPREAD) / 10.0; else gd128 = MarketInfo(Symbol(), MODE_SPREAD); if (LockInPipsAt > 0) { for (int lpos0 = 0; lpos0 < OrdersTotal(); lpos0++) { OrderSelect(lpos0, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol()) { switch (OrderType()) { case OP_BUY: // if (iClose(OrderSymbol(), 0, 0) - OrderOpenPrice() >= LockInPipsAt * gd120 && OrderStopLoss() == OrderOpenPrice() + LockInPips1* gd120) {continue;} if (iClose(OrderSymbol(), 0, 0) - OrderOpenPrice() >= LockInPipsAt * gd120 && OrderStopLoss() != OrderOpenPrice() + LockInPips1* gd120) { if (OrderStopLoss() < OrderOpenPrice()) { OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + LockInPips * gd120, OrderTakeProfit(), 0, CLR_NONE); Print("Stop Loss adjusted to ", LockInPips, " pips"); PlaySound(gs144); } } break; case OP_SELL: if (OrderOpenPrice() - iClose(OrderSymbol(), 0, 0) >= LockInPipsAt * gd120 && OrderStopLoss() != OrderOpenPrice() - LockInPips1 * gd120) { if (OrderStopLoss() > OrderOpenPrice()) { OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - LockInPips * gd120, OrderTakeProfit(), 0, Yellow); Print("Stop Loss adjusted to ", LockInPips, " pips"); PlaySound(gs144); } } } } } if (LockInPipsAt1 > 0) { for (int lpos1 = 0; lpos1 < OrdersTotal(); lpos1++) { OrderSelect(lpos1, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol()) { switch (OrderType()) { case OP_BUY: if (iClose(OrderSymbol(), 0, 0) - OrderOpenPrice() >= LockInPipsAt1 * gd120) { if (OrderStopLoss() < OrderOpenPrice()) { OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + LockInPips1 * gd120, OrderTakeProfit(), 0, CLR_NONE); Print("Stop Loss adjusted to ", LockInPips1, " pips"); PlaySound(gs144); } } break; case OP_SELL: if (OrderOpenPrice() - iClose(OrderSymbol(), 0, 0) >= LockInPipsAt1 * gd120) { if (OrderStopLoss() > OrderOpenPrice()) { OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - LockInPips1 * gd120, OrderTakeProfit(), 0, Yellow); Print("Stop Loss adjusted to ", LockInPips1, " pips"); PlaySound(gs144); } } } } } } return (0); } }