9-е МЕСТО на ЧЕМПИОНАТЕ-2007 по автотрейдингу
Советник "SkyForex"
Страница: 1
Сообщений 1 страница 2 из 2
Поделиться22008-12-30 21:29:05
Код:
//==================================================================== extern double StopLoss = 120.0; extern int risk = 8; extern double newTakeProfit = 6.0; extern double TrailingStop = 0.0; extern bool MM = FALSE; extern int MaxLot = 100; extern double MinLot = 0.1; extern double lotsi = 0.1; extern bool Hedge = FALSE; extern int AccLeverage = 100; extern int myBrokerType = 0; extern int Hour_1 = 21; extern int Hour_2 = 21; extern int Hour_3 = 21; extern int Hour_4 = 21; extern int Minutes = 60; extern int Slippage = 2; extern int Max_Orders = 5; extern int Distance = 1; string g_comment_172 = "SkyForex FX-Systems (c) 2005"; extern int Magic1 = 85750; bool gi_184 = FALSE; string gs_188 = "EURmeiJyh_ENTRY.wav"; string gs_196 = "EURmeiJyh_EXIT.wav"; string gs_unused_204 = "meiJyh.wav"; string gs_212 = "meiJyh.wav"; int g_magic_220 = 200; int g_timeframe_224 = PERIOD_M5; bool gi_228 = FALSE; double gd_232 = 5.8; int gi_240 = 1; int gi_244 = 0; bool gi_248 = FALSE; int gi_252 = 75; bool gi_256 = FALSE; double gd_260 = 3000.0; bool gi_268 = FALSE; int gi_272 = 124; int gi_276 = 0; int gi_280 = -5; bool gi_284 = TRUE; int gi_288 = 0; bool gi_292 = FALSE; bool gi_296 = FALSE; int gi_300 = 0; int gi_304 = 15; bool gi_308 = FALSE; int gi_312 = 16; int g_color_316 = Black; int g_period_320 = 240; int gi_324 = 1; int gi_328 = 2; int g_count_340 = 0; int g_count_344 = 0; int g_count_348 = 0; double g_price_352 = 0.0; double g_price_360 = 0.0; double gd_368 = 0.0; double gd_376 = 0.0; double g_ask_384 = 0.0; double g_bid_392 = 0.0; double gd_400 = 0.0; double g_lots_408 = 0.0; int g_cmd_416 = OP_BUY; int gi_420 = 0; int gi_424 = 0; bool gi_428 = TRUE; double g_ord_open_price_432 = 0.0; int gi_440 = 0; double gd_444 = 0.0; int gi_unused_452 = 0; int gi_456 = 0; double gd_unused_460 = 0.0; double gd_unused_468 = 0.0; double g_tickvalue_476 = 0.0; double gd_484 = 0.0; int gia_492[][2]; bool gi_496 = FALSE; int gi_500 = 0; int g_datetime_504 = 0; //==================================================================== int init() { int li_0 = ArrayResize(gia_492, gi_272); if (li_0 == 0) Print("ERROR RESIZING THE NEWS FILE ARRAY"); return (0); } int deinit() { return (0); } //==================================================================== int start() { bool l_bool_16; string ls_20; int li_4 = 0; double ld_8 = 0; int l_pos_0 = 0; double l_lotstep_28 = MarketInfo(Symbol(), MODE_LOTSTEP); double l_lotsize_36 = MarketInfo(Symbol(), MODE_LOTSIZE); if (l_lotstep_28 == 0.01) li_4 = 2; if (l_lotstep_28 == 0.1) li_4 = 1; if (myBrokerType == 0) { if (l_lotsize_36 != 0.0) ld_8 = AccountEquity() * AccLeverage / l_lotsize_36 * (risk / 100.0); else ld_8 = MinLot; gd_400 = StrToDouble(DoubleToStr(ld_8, li_4)); } if (myBrokerType == 1) { if (MM == TRUE) gd_400 = 10.0 * (AccountBalance() * risk / 100.0 / (StopLoss / 10.0) / 100.0 / Max_Orders); else gd_400 = lotsi; } if (myBrokerType == 2) { if (MM == TRUE) gd_400 = 100.0 * (AccountBalance() * risk / 100.0 / (StopLoss / 10.0) / 100.0 / Max_Orders); else gd_400 = lotsi; } if (gd_400 < MinLot) gd_400 = MinLot; if (gd_400 > MaxLot) gd_400 = MaxLot; g_count_340 = 0; g_count_344 = 0; g_count_348 = 0; for (l_pos_0 = 0; l_pos_0 < OrdersTotal(); l_pos_0++) { if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) { if (OrderType() == OP_BUY || OrderType() == OP_SELL) { g_count_344++; g_datetime_504 = OrderOpenTime(); } if (OrderType() == OP_SELLLIMIT || OrderType() == OP_BUYLIMIT) g_count_348++; g_count_340++; } } } if (gi_268 && Volume[0] < 2.0) { if (!gi_496 || (TimeHour(TimeZoneConvert(TimeCurrent(), gi_276, gi_280)) == 0 && TimeMinute(TimeZoneConvert(TimeCurrent(), gi_276, gi_280)) <= 3)) OrdersControlbyTime(); gi_500 = CurTimeInNonTrading(); } if (g_count_340 < 1) { if (gi_268 && gi_500 == 1) return (0); if (!gi_284 && DayOfWeek() == 5) { Comment("TradeOnfriday is False"); return (0); } } g_tickvalue_476 = MarketInfo(Symbol(), MODE_TICKVALUE); if (g_tickvalue_476 == 0.0) g_tickvalue_476 = 5; if (gi_256 && AccountBalance() - AccountEquity() >= gd_260) { ls_20 = ls_20 + "\nClosing orders because account money protection was triggered."; Print("Closing orders because account money protection was triggered. Balance: ", AccountBalance(), " Equity: ", AccountEquity()); gi_440 = g_count_340 + 1; gi_428 = FALSE; return (0); } if (gi_248 && AccountEquity() <= AccountBalance() * gi_252 / 100.0) { ls_20 = ls_20 + "\nClosing orders because account equity protection was triggered."; Print("Closing orders because account equity protection was triggered. Balance: ", AccountBalance(), " Equity: ", AccountEquity()); gi_440 = g_count_340 + 1; gi_428 = FALSE; return (0); } if (gi_268 && gi_500 == 1) { gi_440 = g_count_340 + 1; gi_428 = FALSE; ls_20 = ls_20 + "\nClosing all orders and stop trading because NewsFileProtection was triggered."; Print("Closing all orders and stop trading because NewsFileProtection was triggered."); } if (!gi_284 && DayOfWeek() == 5) { gi_440 = g_count_340 + 1; gi_428 = FALSE; ls_20 = ls_20 + "\nClosing all orders and stop trading because TradeOnFriday protection."; Print("Closing all orders and stop trading because TradeOnFriday protection."); } if (gi_288 > 0 && TimeCurrent() - g_datetime_504 > gi_288) { gi_440 = g_count_340 + 1; gi_428 = FALSE; ls_20 = ls_20 + "\nClosing all orders because OrdersTimeAlive protection."; Print("Closing all orders because OrdersTimeAlive protection."); } if (gi_440 > g_count_340) { for (l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) { if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) { g_cmd_416 = OrderType(); if ((OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) || gi_244 == 1) { if (g_cmd_416 == OP_BUY) { OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, g_color_316); if (gi_184) PlaySound(gs_196); } if (g_cmd_416 == OP_SELL) { OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, g_color_316); if (gi_184) PlaySound(gs_196); } if (g_cmd_416 == OP_BUYLIMIT) { OrderDelete(OrderTicket()); if (gi_184) PlaySound(gs_196); } if (g_cmd_416 == OP_SELLLIMIT) { OrderDelete(OrderTicket()); if (gi_184) PlaySound(gs_196); } return (0); } } } } gi_440 = g_count_340; if (g_count_340 >= Max_Orders) gi_428 = FALSE; else gi_428 = TRUE; if (g_ord_open_price_432 == 0.0) { for (l_pos_0 = 0; l_pos_0 < OrdersTotal(); l_pos_0++) { if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) { g_cmd_416 = OrderType(); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) { g_ord_open_price_432 = OrderOpenPrice(); if (g_cmd_416 == OP_BUY) gi_420 = 2; if (g_cmd_416 == OP_SELL) gi_420 = 1; } } } } if (gi_228 && g_count_348 >= Max_Orders - gi_240) { gd_444 = 0; gi_unused_452 = 0; gi_456 = FALSE; gd_unused_460 = 0; gd_unused_468 = 0; for (l_pos_0 = 0; l_pos_0 < OrdersTotal(); l_pos_0++) { if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) { if (OrderType() == OP_BUY || OrderType() == OP_SELL) { gi_unused_452 = OrderTicket(); if (OrderType() == OP_BUY) gi_456 = FALSE; if (OrderType() == OP_SELL) gi_456 = TRUE; gd_unused_460 = OrderClosePrice(); gd_unused_468 = OrderLots(); if (gi_456 == FALSE) { if (OrderClosePrice() < OrderOpenPrice()) gd_444 -= (OrderOpenPrice() - OrderClosePrice()) * OrderLots() / Point; if (OrderClosePrice() > OrderOpenPrice()) gd_444 += (OrderClosePrice() - OrderOpenPrice()) * OrderLots() / Point; } if (gi_456 == TRUE) { if (OrderClosePrice() > OrderOpenPrice()) gd_444 -= (OrderClosePrice() - OrderOpenPrice()) * OrderLots() / Point; if (OrderClosePrice() < OrderOpenPrice()) gd_444 += (OrderOpenPrice() - OrderClosePrice()) * OrderLots() / Point; } } } } gd_444 *= g_tickvalue_476; if (gi_244 == 1) gd_484 = AccountBalance(); else gd_484 = gd_232 * gd_400; if (gd_444 >= gd_484) { ls_20 = ls_20 + "\nClosing orders because account protection with SecureProfit was triggered."; Print("Closing orders because account protection with SecureProfit was triggered. Balance: ", AccountBalance(), " Equity: ", AccountEquity(), " Profit: ", gd_444); gi_440 = g_count_340 + 1; gi_428 = FALSE; return (0); } } gi_424 = 3; switch (gi_304) { case 0: gi_424 = OpenOrdersBasedOnMACD(); break; case 1: gi_424 = OpenOrdersBasedOnPivot(); break; case 2: gi_424 = OpenOrdersBasedOnSupRes(); break; case 3: gi_424 = OpenOrdersBasedOnPSAR(); break; case 4: gi_424 = OpenOrdersBasedOnBrainTrend1Sig(); break; case 5: gi_424 = OpenOrdersBasedOnSell(); break; case 6: gi_424 = OpenOrdersBasedOnBuy(); break; case 7: gi_424 = OpenOrdersBasedOnRSI2MA(); break; case 8: gi_424 = OpenOrdersBasedOnMovingAverage(); break; case 9: gi_424 = OpenOrdersBasedOnCCI(); break; case 10: gi_424 = OpenOrdersBasedOnBullsandBears(); break; case 11: gi_424 = OpenOrdersBasedOnTrendManager(); break; case 12: gi_424 = OpenOrdersBasedOnFXFish(); break; case 13: gi_424 = OpenOrdersBasedOnOpenClose(); break; case 14: gi_424 = OpenOrdersBasedOnTOPzone(); break; case 15: gi_424 = OpenOrdersBasedOnWPR(); break; default: gi_424 = OpenOrdersBasedOnMACD(); } if (g_count_340 < 1 && gi_300 == 0) { gi_420 = gi_424; if (gi_292) { if (gi_420 == 1) gi_420 = 2; else if (gi_420 == 2) gi_420 = 1; } } if (gi_308 && gi_292) { if (gi_424 == 1) gi_424 = 2; else if (gi_424 == 2) gi_424 = 1; } for (l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) { if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) { if (OrderType() == OP_SELL) { if (gi_308 && gi_424 == 2) { gi_440 = g_count_340 + 1; gi_428 = FALSE; ls_20 = ls_20 + "\nClosing all orders because Indicator triggered another signal."; Print("Closing all orders because Indicator triggered another signal."); } if (TrailingStop > 0.0) { if (OrderOpenPrice() - OrderClosePrice() >= TrailingStop * Point + Distance * Point) { if (OrderStopLoss() > OrderClosePrice() + TrailingStop * Point) { l_bool_16 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderClosePrice() + TrailingStop * Point, OrderClosePrice() - newTakeProfit * Point - TrailingStop * Point, 0, Purple); if (l_bool_16 != TRUE) Print("LastError = ", GetLastError()); else OrderPrint(); return (0); } } } } if (OrderType() == OP_BUY) { if (gi_308 && gi_424 == 1) { gi_440 = g_count_340 + 1; gi_428 = FALSE; ls_20 = ls_20 + "\nClosing all orders because Indicator triggered another signal."; Print("Closing all orders because Indicator triggered another signal."); } if (TrailingStop > 0.0) { if (OrderClosePrice() - OrderOpenPrice() >= TrailingStop * Point + Distance * Point) { if (OrderStopLoss() < OrderClosePrice() - TrailingStop * Point) { l_bool_16 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderClosePrice() - TrailingStop * Point, OrderClosePrice() + newTakeProfit * Point + TrailingStop * Point, 0, g_color_316); if (l_bool_16 != TRUE) Print("LastError = ", GetLastError()); else OrderPrint(); return (0); } } } } } } if (g_count_340 < 1) OpenMarketOrders(); else { if (gi_296) OpenLimitOrders(); else OpenMarketOrders(); } return (0); } //==================================================================== void OpenMarketOrders() { int l_count_0 = 0; if (gi_420 == 1 && gi_428) { if (Bid - g_ord_open_price_432 >= Distance * Point || g_count_340 < 1) { g_bid_392 = Bid; g_ord_open_price_432 = 0; if (newTakeProfit == 0.0) g_price_360 = 0; else { g_price_360 = g_bid_392 - newTakeProfit * Point; gd_376 = g_bid_392 + StopLoss * Point + newTakeProfit * Point; } if (StopLoss == 0.0) g_price_352 = 0; else { g_price_352 = g_bid_392 + StopLoss * Point; gd_368 = g_price_352 - StopLoss * Point; } if (g_count_340 != 0) { g_lots_408 = gd_400; for (l_count_0 = 0; l_count_0 < g_count_340; l_count_0++) { if (Max_Orders > 12) g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); else g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); } } else g_lots_408 = gd_400; if (g_lots_408 > MaxLot) g_lots_408 = MaxLot; if (Hedge == TRUE) { OrderSend(Symbol(), OP_SELL, g_lots_408, g_bid_392, Slippage, 0, g_price_360, g_comment_172, Magic1, 0, g_color_316); OrderSend(Symbol(), OP_BUYSTOP, g_lots_408, g_price_352, Slippage, 0, 0, g_comment_172, g_magic_220, 0, g_color_316); } else OrderSend(Symbol(), OP_SELL, g_lots_408, g_bid_392, Slippage, g_price_352, g_price_360, g_comment_172, Magic1, 0, g_color_316); if (!(gi_184)) return; PlaySound(gs_188); return; } } if (gi_420 == 2 && gi_428) { if (g_ord_open_price_432 - Ask >= Distance * Point || g_count_340 < 1) { g_ask_384 = Ask; g_ord_open_price_432 = 0; if (newTakeProfit == 0.0) g_price_360 = 0; else { g_price_360 = g_ask_384 + newTakeProfit * Point; gd_376 = g_ask_384 - StopLoss * Point - newTakeProfit * Point; } if (StopLoss == 0.0) g_price_352 = 0; else { g_price_352 = g_ask_384 - StopLoss * Point; gd_368 = g_price_352 + StopLoss * Point; } if (g_count_340 != 0) { g_lots_408 = gd_400; for (l_count_0 = 0; l_count_0 < g_count_340; l_count_0++) { if (Max_Orders > 12) g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); else g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); } } else g_lots_408 = gd_400; if (g_lots_408 > MaxLot) g_lots_408 = MaxLot; if (Hedge == TRUE) { OrderSend(Symbol(), OP_BUY, g_lots_408, g_ask_384, Slippage, 0, g_price_360, g_comment_172, Magic1, 0, g_color_316); OrderSend(Symbol(), OP_SELLSTOP, g_lots_408, g_price_352, Slippage, 0, 0, g_comment_172, g_magic_220, 0, g_color_316); } else OrderSend(Symbol(), OP_BUY, g_lots_408, g_ask_384, Slippage, g_price_352, g_price_360, g_comment_172, Magic1, 0, g_color_316); if (gi_184) PlaySound(gs_188); } } } //==================================================================== void OpenLimitOrders() { int l_count_0 = 0; if (gi_420 == 1 && gi_428) { g_bid_392 = g_ord_open_price_432 + Distance * Point; g_ord_open_price_432 = 0; if (newTakeProfit == 0.0) g_price_360 = 0; else g_price_360 = g_bid_392 - newTakeProfit * Point; if (StopLoss == 0.0) g_price_352 = 0; else g_price_352 = g_bid_392 + StopLoss * Point; if (g_count_340 != 0) { g_lots_408 = gd_400; for (l_count_0 = 0; l_count_0 < g_count_340; l_count_0++) { if (Max_Orders > 12) g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); else g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); } } else g_lots_408 = gd_400; if (g_lots_408 > MaxLot) g_lots_408 = MaxLot; OrderSend(Symbol(), OP_SELLLIMIT, g_lots_408, g_bid_392, Slippage, g_price_352, g_price_360, g_comment_172, Magic1, 0, g_color_316); if (gi_184) PlaySound(gs_212); } else { if (gi_420 == 2 && gi_428) { g_ask_384 = g_ord_open_price_432 - Distance * Point; g_ord_open_price_432 = 0; if (newTakeProfit == 0.0) g_price_360 = 0; else g_price_360 = g_ask_384 + newTakeProfit * Point; if (StopLoss == 0.0) g_price_352 = 0; else g_price_352 = g_ask_384 - StopLoss * Point; if (g_count_340 != 0) { g_lots_408 = gd_400; for (l_count_0 = 0; l_count_0 < g_count_340; l_count_0++) { if (Max_Orders > 12) g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); else g_lots_408 = NormalizeDouble(1.0 * g_lots_408, 2); } } else g_lots_408 = gd_400; if (g_lots_408 > MaxLot) g_lots_408 = MaxLot; OrderSend(Symbol(), OP_BUYLIMIT, g_lots_408, g_ask_384, Slippage, g_price_352, g_price_360, g_comment_172, Magic1, 0, g_color_316); if (gi_184) PlaySound(gs_212); } } } //==================================================================== int OrdersControlbyTime() { int l_file_0 = FileOpen("DLMv1.2-NonTradingDays.csv", FILE_CSV|FILE_READ, ';'); if (l_file_0 < 1) { Print("File DLMv1.2-NonTradingDays.csv not found, the last error is ", GetLastError()); gi_496 = FALSE; return (0); } int l_index_4 = 0; int li_unused_8 = 0; while (!FileIsEnding(l_file_0) || l_index_4 < gi_272) { if (!FileIsEnding(l_file_0)) { gia_492[l_index_4][0] = StrToTime(FileReadString(l_file_0, 0)); gia_492[l_index_4][1] = StrToTime(FileReadString(l_file_0, 1)); } l_index_4++; } gi_496 = TRUE; FileClose(l_file_0); return (1); } //==================================================================== int CurTimeInNonTrading() { int li_ret_4 = 0; for (int l_index_0 = 0; l_index_0 < gi_272; l_index_0++) { if (TimeZoneConvert(TimeCurrent(), gi_280, gi_280) >= gia_492[l_index_0][0] && TimeZoneConvert(TimeCurrent(), gi_276, gi_280) < gia_492[l_index_0][1]) li_ret_4 = 1; if (TimeZoneConvert(TimeCurrent(), gi_276, gi_280) >= gia_492[l_index_0][1]) li_ret_4 = 2; } return (li_ret_4); } //==================================================================== int TimeZoneConvert(int ai_0, int ai_4, int ai_8) { int li_12 = ai_4 - ai_8; int li_16 = TimeHour(ai_0) - li_12; int li_ret_20 = ai_0; if (ai_4 < -12 || ai_4 > 14) { Print("Zone1 value is invalid (", ai_4, ") the value must be from -12 to +14"); return (ai_0); } if (ai_8 < -12 || ai_8 > 14) { Print("Zone2 value is invalid (", ai_8, ") the value must be from -12 to +14"); return (ai_0); } li_ret_20 = StrToTime(TimeYear(ai_0) + "." + TimeMonth(ai_0) + "." + TimeDay(ai_0) + " " + li_16 + ":" + TimeMinute(ai_0)); if (li_16 < 0) { li_16 += 24; li_ret_20 = StrToTime(TimeYear(ai_0) + "." + TimeMonth(ai_0) + "." + TimeDay(ai_0) + " " + li_16 + ":" + TimeMinute(ai_0)) - 86400; } if (li_16 > 24) { li_16 -= 24; li_ret_20 = StrToTime(TimeYear(ai_0) + "." + TimeMonth(ai_0) + "." + TimeDay(ai_0) + " " + li_16 + ":" + TimeMinute(ai_0)) + 86400; } return (li_ret_20); } //==================================================================== int OpenOrdersBasedOnMACD() { int li_ret_0 = 3; double l_imacd_4 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0); double l_imacd_12 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1); double l_imacd_20 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0); double l_imacd_28 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1); double l_ima_36 = iMA(NULL, 0, 26, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_44 = iMA(NULL, 0, 26, 0, MODE_EMA, PRICE_CLOSE, 1); if (l_imacd_4 < 0.0 && l_imacd_4 > l_imacd_20 && l_imacd_12 < l_imacd_28 && MathAbs(l_imacd_4) > 3.0 * Point && l_ima_36 > l_ima_44) li_ret_0 = 2; if (l_imacd_4 > 0.0 && l_imacd_4 < l_imacd_20 && l_imacd_12 > l_imacd_28 && l_imacd_4 > 3.0 * Point && l_ima_36 < l_ima_44) li_ret_0 = 1; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnPivot() { int li_ret_0 = 3; double l_icustom_4 = 0; l_icustom_4 = iCustom(Symbol(), 0, "Pivot Lines TimeZone", gi_312, 1, 0, 0, 0, 0); if (Close[0] > l_icustom_4) li_ret_0 = 1; if (Close[0] < l_icustom_4) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnSupRes() { int li_ret_0 = 3; double l_icustom_4 = 0; double l_icustom_12 = 0; l_icustom_4 = iCustom(Symbol(), 0, "Support and Resistance", 0, 0); l_icustom_12 = iCustom(Symbol(), 0, "Support and Resistance", 1, 0); if (Close[0] <= l_icustom_12 + 4.0 * Point && Close[0] >= l_icustom_12) li_ret_0 = 2; if (Close[0] >= l_icustom_4 - 4.0 * Point && Close[0] <= l_icustom_4) li_ret_0 = 1; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnPSAR() { int li_ret_0 = 3; if (iSAR(NULL, 0, 0.02, 0.2, 1) <= Low[1] && iSAR(NULL, 0, 0.02, 0.2, 0) > High[0]) li_ret_0 = 1; if (iSAR(NULL, 0, 0.02, 0.2, 1) >= High[1] && iSAR(NULL, 0, 0.02, 0.2, 0) < Low[0]) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnBrainTrend1Sig() { int li_ret_0 = 3; double l_icustom_4 = iCustom(NULL, 0, "BrainTrend1Stop", 10, 0, 0); double l_icustom_12 = iCustom(NULL, 0, "BrainTrend1Stop", 10, 0, 1); double l_icustom_20 = iCustom(NULL, 0, "BrainTrend1Stop", 10, 1, 0); double l_icustom_28 = iCustom(NULL, 0, "BrainTrend1Stop", 10, 1, 1); if (l_icustom_4 && !l_icustom_12) li_ret_0 = 1; if (l_icustom_20 && !l_icustom_28) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnSell() { return (1); } //==================================================================== int OpenOrdersBasedOnBuy() { return (2); } //==================================================================== int OpenOrdersBasedOnRSI2MA() { int li_ret_0 = 3; double l_icustom_4 = iCustom(Symbol(), 0, "RSI 2MA", 14, 21, 9, 70, 30, "SMA", "--", 0, 3, 1, 1); double l_icustom_12 = iCustom(Symbol(), 0, "RSI 2MA", 14, 21, 9, 70, 30, "SMA", "--", 0, 3, 2, 1); double l_icustom_20 = iCustom(Symbol(), 0, "RSI 2MA", 14, 21, 9, 70, 30, "SMA", "--", 0, 3, 1, 2); double l_icustom_28 = iCustom(Symbol(), 0, "RSI 2MA", 14, 21, 9, 70, 30, "SMA", "--", 0, 3, 2, 2); if (l_icustom_20 >= l_icustom_28 && l_icustom_4 < l_icustom_12) li_ret_0 = 1; if (l_icustom_20 <= l_icustom_28 && l_icustom_4 > l_icustom_12) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnMovingAverage() { int li_ret_0 = 3; double l_ima_4 = iMA(NULL, 0, 12, 6, MODE_SMA, PRICE_CLOSE, 0); if (Open[1] > l_ima_4 && Close[1] < l_ima_4) li_ret_0 = 1; if (Open[1] < l_ima_4 && Close[1] > l_ima_4) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnCCI() { int li_ret_0 = 3; double l_icci_4 = iCCI(Symbol(), 0, 8, PRICE_LOW, 1); double l_icci_12 = iCCI(Symbol(), 0, 8, PRICE_LOW, 2); if (l_icci_12 >= 0.0 && l_icci_4 < 0.0) li_ret_0 = 1; if (l_icci_12 <= 0.0 && l_icci_4 > 0.0) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnBullsandBears() { int li_ret_0 = 3; double l_ibullspower_4 = iBullsPower(NULL, 0, 5, PRICE_CLOSE, 1); double l_ibearspower_12 = iBearsPower(NULL, 0, 5, PRICE_CLOSE, 1); if (l_ibullspower_4 + l_ibearspower_12 < 0.0) li_ret_0 = 1; if (l_ibullspower_4 + l_ibearspower_12 > 0.0) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnTrendManager() { int li_ret_0 = 3; double l_icustom_4 = iCustom(Symbol(), 0, "Trend Manager", 0.0007, 23, 1, 84, 1, 500, 0, 1); double l_icustom_12 = iCustom(Symbol(), 0, "Trend Manager", 0.0007, 23, 1, 84, 1, 500, 1, 1); if (l_icustom_12 < l_icustom_4) li_ret_0 = 1; if (l_icustom_12 > l_icustom_4) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnFXFish() { int li_ret_0 = 3; double l_icustom_4 = iCustom(Symbol(), 0, "FX_FISH", 10, 0, 1, 0, 0, 1); double l_icustom_12 = iCustom(Symbol(), 0, "FX_FISH", 10, 0, 1, 0, 1, 1); if (l_icustom_12 < l_icustom_4) li_ret_0 = 1; if (l_icustom_12 > l_icustom_4) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnOpenClose() { int li_ret_0 = 3; if (iOpen(Symbol(), 0, 1) - iClose(Symbol(), 0, 1) > 10.0 * Point) li_ret_0 = 1; if (iClose(Symbol(), 0, 1) - iOpen(Symbol(), 0, 1) > 10.0 * Point) li_ret_0 = 2; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnTOPzone() { int li_ret_0 = 3; double l_ima_4 = iMA(NULL, PERIOD_M30, 8, 0, MODE_LWMA, PRICE_CLOSE, 0); double l_ima_12 = iMA(NULL, PERIOD_M30, 13, 0, MODE_LWMA, PRICE_CLOSE, 0); double l_ima_20 = iMA(NULL, PERIOD_M30, 55, 0, MODE_LWMA, PRICE_CLOSE, 0); double l_ima_28 = iMA(NULL, PERIOD_M30, 89, 0, MODE_LWMA, PRICE_CLOSE, 0); double l_ima_36 = iMA(NULL, PERIOD_M15, 13, 0, MODE_LWMA, PRICE_CLOSE, 0); double l_ima_44 = iMA(NULL, PERIOD_M15, 13, 0, MODE_LWMA, PRICE_CLOSE, 1); double l_ima_52 = iMA(NULL, PERIOD_M15, 8, 0, MODE_LWMA, PRICE_CLOSE, 0); double l_ima_60 = iMA(NULL, PERIOD_M15, 8, 0, MODE_LWMA, PRICE_CLOSE, 1); if (l_ima_4 > l_ima_12 && l_ima_44 < l_ima_36 && l_ima_60 < l_ima_52 && l_ima_12 > l_ima_28 && l_ima_20 > l_ima_28 && l_ima_12 > l_ima_20) li_ret_0 = 2; if (l_ima_4 < l_ima_12 && l_ima_44 > l_ima_36 && l_ima_60 > l_ima_52 && l_ima_12 < l_ima_28 && l_ima_20 < l_ima_28 && l_ima_12 < l_ima_20) li_ret_0 = 1; return (li_ret_0); } //==================================================================== int OpenOrdersBasedOnWPR() { int li_ret_0 = 3; double ld_unused_4 = iWPR(NULL, g_timeframe_224, g_period_320, gi_324); double ld_unused_12 = iWPR(NULL, g_timeframe_224, g_period_320, gi_328); if (Hour() == Hour_1 || Hour() == Hour_2 || Hour() == Hour_3 || Hour() == Hour_4 && Minute() <= Minutes && iSAR(NULL, g_timeframe_224, 0.02, 0.2, 0) < Low[5] && iMA(NULL, g_timeframe_224, 13, 0, MODE_EMA, PRICE_CLOSE, 0) > iMA(NULL, g_timeframe_224, 144, 0, MODE_EMA, PRICE_CLOSE, 0) && iMA(NULL, g_timeframe_224, 1, 0, MODE_LWMA, PRICE_CLOSE, 0) - 20.0 * Point < High[60]) li_ret_0 = 2; if (Hour() == Hour_1 || Hour() == Hour_2 || Hour() == Hour_3 || Hour() == Hour_4 && Minute() <= Minutes && iSAR(NULL, g_timeframe_224, 0.02, 0.2, 0) > High[5] && iMA(NULL, g_timeframe_224, 13, 0, MODE_EMA, PRICE_CLOSE, 0) < iMA(NULL, g_timeframe_224, 144, 0, MODE_EMA, PRICE_CLOSE, 0) && iMA(NULL, g_timeframe_224, 1, 0, MODE_LWMA, PRICE_CLOSE, 0) + 20.0 * Point > Low[60]) li_ret_0 = 1; return (li_ret_0); }
Страница: 1