#property copyright "Copyright © 2009, Michael E Wilkinson DDS" #property link "mewddsltd@msn.com" #property show_inputs #include extern bool ModifyOpenLong = FALSE; extern bool ModifyOpenShort = FALSE; extern bool ModifyPendingLong = FALSE; extern bool ModifyPendingShort = FALSE; int AuthorizedDate() { bool li_ret_0; string ls_4 = "2009.12.31"; int l_str2time_12 = StrToTime(ls_4); if (TimeCurrent() <= l_str2time_12) li_ret_0 = TRUE; else li_ret_0 = FALSE; return (li_ret_0); } int AuthorizedAccount(int ai_0) { bool li_ret_4 = FALSE; if (ai_0 == 6025474 || ai_0 == 6048211 || ai_0 == 6048211 || ai_0 == 5569156 || ai_0 == 2088182226 || ai_0 == 2088203736 || ai_0 == 6046489 || ai_0 == 2368036 || ai_0 == 5661503 || ai_0 == 11201 || ai_0 == 1139824 || ai_0 == 6054916 || ai_0 == 5672146 || ai_0 == 6054298 || ai_0 == 6056548 || ai_0 == 2413999 || ai_0 == 1612010 || ai_0 == 1612012 || ai_0 == 1612015 || ai_0 == 1613288 || ai_0 == 1613289 || ai_0 == 1613290 || ai_0 == 1613292 || ai_0 == 1613293 || ai_0 == 1614331 || ai_0 == 5635503) li_ret_4 = TRUE; else li_ret_4 = FALSE; return (li_ret_4); } int AuthorizedKey(int ai_0) { bool li_ret_4 = FALSE; int li_8 = 1 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 0, 2)); int li_12 = 3 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 2, 2)); int li_16 = 5 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 4, 2)); int li_20 = StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 6, 2)) * 2; int li_24 = StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 8, 2)) << 2; int li_28 = 6 * StrToInteger(StringSubstr(DoubleToStr(ai_0, 0), 10, 2)); int li_32 = li_8 + li_12 + li_16 + li_20 + li_24 + li_28; if (li_32 == 57 || li_32 == 61 || li_32 == 67 || li_32 == 76 || li_32 == 200 || li_32 == 204 || li_32 == 206 || li_32 == 211 || li_32 == 213 || li_32 == 225 || li_32 == 254 || li_32 == 311 || li_32 == 349 || li_32 == 354 || li_32 == 378 || li_32 == 383 || li_32 == 417 || li_32 == 456 || li_32 == 495 || li_32 == 514 || li_32 == 522 || li_32 == 546 || li_32 == 576 || li_32 == 602 || li_32 == 689) li_ret_4 = TRUE; else li_ret_4 = FALSE; return (li_ret_4); } int start() { int l_digits_0; int l_pos_4; int l_mb_code_8; double l_price_12; if (AuthorizedDate() && AuthorizedAccount(AccountNumber()) && AuthorizedKey(AccountNumber())) { l_digits_0 = MarketInfo(Symbol(), MODE_DIGITS); l_pos_4 = 0; l_price_12 = NormalizeDouble(WindowPriceOnDropped(), l_digits_0); if (ModifyOpenLong) { l_mb_code_8 = MessageBox("Are you sure you want to modify the stop loss on all open buy orders?", "Question", MB_YESNO|32|262144); if (l_mb_code_8 == IDYES) { for (l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol()) { RefreshRates(); if (OrderType() == OP_BUY) if (l_price_12 < Bid) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_12, OrderTakeProfit(), OrderExpiration(), White); } } } } } if (ModifyOpenShort) { l_mb_code_8 = MessageBox("Are you sure you want to modify the stop loss on all open buy orders?", "Question", MB_YESNO|32|262144); if (l_mb_code_8 == IDYES) { for (l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol()) { RefreshRates(); if (OrderType() == OP_SELL) if (l_price_12 > Ask) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_12, OrderTakeProfit(), OrderExpiration(), White); } } } } } if (ModifyPendingLong) { l_mb_code_8 = MessageBox("Are you sure you want to modify the stop loss on all open buy orders?", "Question", MB_YESNO|32|262144); if (l_mb_code_8 == IDYES) { for (l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol()) { RefreshRates(); if (OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT) if (l_price_12 < OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_12, OrderTakeProfit(), OrderExpiration(), White); } } } } } if (ModifyPendingShort) { l_mb_code_8 = MessageBox("Are you sure you want to modify the stop loss on all open buy orders?", "Question", MB_YESNO|32|262144); if (l_mb_code_8 == IDYES) { for (l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol()) { RefreshRates(); if (OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT) if (l_price_12 > OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_12, OrderTakeProfit(), OrderExpiration(), White); } } } } } return (0); } Alert("Use of this script is not authorized on this account!"); return (0); }