From e41548979eb0e687deba1d804eee28ac169d1522 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 24 Jun 2024 18:28:48 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x121.setup.xea.mq5 | 197 ++++++++++++++++++-------- Experts/x-saherelm.x121.ea.mq5 | 2 +- 2 files changed, 137 insertions(+), 62 deletions(-) diff --git a/Classes/x-saherelm.x121.setup.xea.mq5 b/Classes/x-saherelm.x121.setup.xea.mq5 index 0841a422..98db8ca4 100644 --- a/Classes/x-saherelm.x121.setup.xea.mq5 +++ b/Classes/x-saherelm.x121.setup.xea.mq5 @@ -1991,83 +1991,158 @@ public: for (int i = 0; i < count; i++) { // + double iEntry = data[i].entry; string iSymbol = data[i].symbol; ENUM_TIMEFRAMES iPeriod = data[i].period; + ENUM_X_POSITION_TYPES iType = data[i].type; // - double hotLevels[]; + bool isLong = IsLong(iType); + ENUM_POSITION_TYPE iPType = isLong + ? POSITION_TYPE_BUY + : POSITION_TYPE_SELL; // - AddSpecific( - 0.25, - hotLevels // - ); - - // - AddSpecific( - 0.20, - hotLevels // - ); - - // - AddSpecific( - 0.12, - hotLevels // - ); - - // - XSCZonesInput zonesInput; - zonesInput.length = 71; - zonesInput.numberOfZones = 10; - XSCZones *zones = new XSCZones( + double cEntry = GetEntry( iSymbol, - _Period // + iPType // ); // - zonesInput.AddLevelColor( - hotLevels[0], - clrRed // - ); - zonesInput.AddLevelColor( - hotLevels[1], - clrOrange // - ); - zonesInput.AddLevelColor( - hotLevels[2], - clrLightCoral // - ); - bool canUseZones = zones.Init(zonesInput); - - // - XSCCFInput cfInputs; - cfInputs.Default(); - XSCCF *cf = new XSCCF( + XOHCL cBar; + bool isInited = cBar.Init( iSymbol, - _Period // + iPeriod, + 1 // ); - bool canUseCF = cf.Init(cfInputs); + if (!isInited) + { + continue; + } // - XSCTrendInput tInputs; - tInputs.Default(); - XSCTrend *trend = new XSCTrend( - iSymbol, - _Period // - ); - bool canUseTrend = trend.Init(tInputs); + bool isBullish = cBar.IsBullish(); + bool isBreakUp = cBar.IsBreakUp(iEntry); - if (canUseCF && canUseTrend && canUseZones) + // + bool isBearish = cBar.IsBearish(); + bool isBreakDown = cBar.IsBreakDown(iEntry); + + // + bool isBreaked = + isLong + ? isBullish && isBreakUp && cEntry > iEntry + : isBearish && isBreakDown && cEntry < iEntry; + + // + if (isBreaked) { // - // cf.Draw(); - trend.Draw(); - // zones.Draw(); - Print("Use CF ..."); - // cf.Remove(); - // trend.Remove(); - // zones.Remove(); + // Update Date of TradeInfo ... + data[i].entry = cEntry; + data[i].time = TimeCurrent(); + + // + // Generate Signal ... + XSignal iSignal; + bool isPrepared = iSignal.Prepare( + data[i].symbol, + data[i].provider, + data[i].period, + iPType, + X_ORDER_MODE_MARKET, + data[i].entry, + data[i].volume, + 0, + 0 // + ); + + // + // Add Signal to Result ... + if (isPrepared) + { + // + AddRef( + iSignal, + signals // + ); + } } + + // // + // double hotLevels[]; + + // // + // AddSpecific( + // 0.25, + // hotLevels // + // ); + + // // + // AddSpecific( + // 0.20, + // hotLevels // + // ); + + // // + // AddSpecific( + // 0.12, + // hotLevels // + // ); + + // // + // XSCZonesInput zonesInput; + // zonesInput.length = 71; + // zonesInput.numberOfZones = 10; + // XSCZones *zones = new XSCZones( + // iSymbol, + // _Period // + // ); + + // // + // zonesInput.AddLevelColor( + // hotLevels[0], + // clrRed // + // ); + // zonesInput.AddLevelColor( + // hotLevels[1], + // clrOrange // + // ); + // zonesInput.AddLevelColor( + // hotLevels[2], + // clrLightCoral // + // ); + // bool canUseZones = zones.Init(zonesInput); + + // // + // XSCCFInput cfInputs; + // cfInputs.Default(); + // XSCCF *cf = new XSCCF( + // iSymbol, + // _Period // + // ); + // bool canUseCF = cf.Init(cfInputs); + + // // + // XSCTrendInput tInputs; + // tInputs.Default(); + // XSCTrend *trend = new XSCTrend( + // iSymbol, + // _Period // + // ); + // bool canUseTrend = trend.Init(tInputs); + + // if (canUseCF && canUseTrend && canUseZones) + // { + // // + // // cf.Draw(); + // trend.Draw(); + // // zones.Draw(); + // Print("Use CF ..."); + // // cf.Remove(); + // // trend.Remove(); + // // zones.Remove(); + // } } // @@ -3571,8 +3646,8 @@ public: bool allowShort = AllowShort(); // - bool useCMarket = false; - bool useSMarket = true; + bool useCMarket = true; + bool useSMarket = false; bool useMMarket = false; bool useLMarket = false; bool useHMarket = false; diff --git a/Experts/x-saherelm.x121.ea.mq5 b/Experts/x-saherelm.x121.ea.mq5 index af280f99..16b064ce 100644 --- a/Experts/x-saherelm.x121.ea.mq5 +++ b/Experts/x-saherelm.x121.ea.mq5 @@ -49,7 +49,7 @@ input bool x121EAUseAllSymbols = false; // Use All Availabl input bool x121EAUseAllWatchListSymbols = false; // Use All WatchList Symbols input bool x121EAAllowLong = true; // Allow Long Trades input bool x121EAAllowShort = true; // Allow Short Trades -input bool x121EAExecuteSignalsOnBreakout = false; // Execute Signals On Breakouts +input bool x121EAExecuteSignalsOnBreakout = true; // Execute Signals On Breakouts input int x121EADelayBetweenTwoSignal = 5; // Delay Between two Same Signals input int x121EAReuiredSignalVerifications = 3; // Required Verifications for Signals input bool x121EAGetVerificationFromOtherTimeFrames = false; // Get Verifications from Other Time Frames