BITCION AND GOLD

MQL5 エキスパート

指定

//+------------------------------------------------------------------+
//|                    LUMO EDGE - MT5 EA                            |
//|                    Owner: Gontse                                 |
//|                                                                  |
//| Automated Forex Scanner & Trading Expert Advisor                |
//| Strategy: EMA 50/200 + ATR + Momentum + Risk Management          |
//+------------------------------------------------------------------+
#property strict
#property version   "1.00"
#property description "Lumo Edge - Automated MT5 Forex Scanner"
#property description "Owner: Gontse"

#include <Trade/Trade.mqh>

CTrade trade;

//====================================================================
// INPUTS
//====================================================================

//--- General
input string   BotName                 = "LUMO EDGE";
input string   OwnerName               = "Gontse";
input long     MagicNumber             = 5050200;

//--- Scanner
input string   SymbolsToScan           =
"EURUSD,GBPUSD,USDJPY,USDCHF,AUDUSD,USDCAD,NZDUSD,"
"EURJPY,GBPJPY,EURGBP,AUDJPY";

//--- Timeframe
input ENUM_TIMEFRAMES SignalTimeframe  = PERIOD_M15;
input ENUM_TIMEFRAMES TrendTimeframe   = PERIOD_H1;

//--- EMA strategy
input int      FastEMA                 = 50;
input int      SlowEMA                 = 200;

//--- ATR
input int      ATRPeriod               = 14;
input double   ATR_SL_Multiplier       = 1.5;
input double   ATR_TP_Multiplier       = 2.0;

//--- Risk
input double   RiskPercent             = 1.0;
input double   MaxDailyLossPercent     = 5.0;
input int      MaxOpenTrades           = 3;

//--- Trade filters
input double   MaxSpreadPoints         = 30;
input int      MinimumSignalScore      = 70;

//--- Profit management
input bool     EnableProfitClose       = true;
input double   MinimumProfitMoney      = 5.00;

//--- Break-even
input bool     EnableBreakEven         = true;
input double   BreakEvenATR            = 1.0;

//--- Trailing stop
input bool     EnableTrailingStop      = true;
input double   TrailingATR             = 1.2;

//--- Trading hours
input bool     UseTradingHours         = true;
input int      StartHour               = 7;
input int      EndHour                 = 21;

//--- Direction
input bool     AllowBuy                = true;
input bool     AllowSell               = true;

//====================================================================
// GLOBALS
//====================================================================

string Symbols[];
datetime LastBarTime[];

//====================================================================
// INITIALIZATION
//====================================================================

int OnInit()
{
   trade.SetExpertMagicNumber(MagicNumber);
   trade.SetDeviationInPoints(20);

   ParseSymbols();

   ArrayResize(LastBarTime, ArraySize(Symbols));

   for(int i = 0; i < ArraySize(LastBarTime); i++)
      LastBarTime[i] = 0;

   Print("==========================================");
   Print(BotName, " initialized.");
   Print("Owner: ", OwnerName);
   Print("Symbols scanned: ", ArraySize(Symbols));
   Print("==========================================");

   return(INIT_SUCCEEDED);
}

//====================================================================
// MAIN LOOP
//====================================================================

void OnTick()
{
   ManageOpenTrades();

   if(!TradingAllowed())
      return;

   if(DailyLossExceeded())
      return;

   if(CountOurPositions() >= MaxOpenTrades)
      return;

   for(int i = 0; i < ArraySize(Symbols); i++)
   {
      string symbol = Symbols[i];

      if(!SymbolSelect(symbol, true))
         continue;

      if(HasOpenPosition(symbol))
         continue;

      if(!IsNewBar(symbol, i))
         continue;

      int signal = GetSignal(symbol);

      if(signal == 1 && AllowBuy)
      {
         if(GetSignalScore(symbol, 1) >= MinimumSignalScore)
            OpenTrade(symbol, ORDER_TYPE_BUY);
      }

      if(signal == -1 && AllowSell)
      {
         if(GetSignalScore(symbol, -1) >= MinimumSignalScore)
            OpenTrade(symbol, ORDER_TYPE_SELL);
      }

      if(CountOurPositions() >= MaxOpenTrades)
         break;
   }

   DrawDashboard();
}

//====================================================================
// SYMBOL PARSER
//====================================================================

void ParseSymbols()
{
   string raw[];
   int count = StringSplit(SymbolsToScan, ',', raw);

   ArrayResize(Symbols, count);

   for(int i = 0; i < count; i++)
   {
      StringTrimLeft(raw[i]);
      StringTrimRight(raw[i]);
      Symbols[i] = raw[i];
   }
}

//====================================================================
// NEW BAR CHECK
//====================================================================

bool IsNewBar(string symbol, int index)
{
   datetime currentBar =
      iTime(symbol, SignalTimeframe, 0);

   if(currentBar == 0)
      return false;

   if(currentBar != LastBarTime[index])
   {
      LastBarTime[index] = currentBar;
      return true;
   }

   return false;
}

//====================================================================
// EMA VALUE
//====================================================================

double GetEMA(string symbol,
              ENUM_TIMEFRAMES timeframe,
              int period,
              int shift)
{
   int handle = iMA(
      symbol,
      timeframe,
      period,
      0,
      MODE_EMA,
      PRICE_CLOSE
   );

   if(handle == INVALID_HANDLE)
      return 0;

   double buffer[];

   ArraySetAsSeries(buffer, true);

   if(CopyBuffer(handle, 0, shift, 1, buffer) <= 0)
   {
      IndicatorRelease(handle);
      return 0;
   }

   double value = buffer[0];

   IndicatorRelease(handle);

   return value;
}

//====================================================================
// ATR VALUE
//====================================================================

double GetATR(string symbol,
              ENUM_TIMEFRAMES timeframe,
              int period,
              int shift)
{
   int handle = iATR(
      symbol,
      timeframe,
      period
   );

   if(handle == INVALID_HANDLE)
      return 0;

   double buffer[];

   ArraySetAsSeries(buffer, true);

   if(CopyBuffer(handle, 0, shift, 1, buffer) <= 0)
   {
      IndicatorRelease(handle);
      return 0;
   }

   double value = buffer[0];

   IndicatorRelease(handle);

   return value;
}

//====================================================================
// SIGNAL
//====================================================================

int GetSignal(string symbol)
{
   double fastEMA =
      GetEMA(symbol, SignalTimeframe, FastEMA, 1);

   double slowEMA =
      GetEMA(symbol, SignalTimeframe, SlowEMA, 1);

   double trendFast =
      GetEMA(symbol, TrendTimeframe, FastEMA, 1);

   double trendSlow =
      GetEMA(symbol, TrendTimeframe, SlowEMA, 1);

   double closePrice =
      iClose(symbol, SignalTimeframe, 1);

   if(fastEMA == 0 ||
      slowEMA == 0 ||
      trendFast == 0 ||
      trendSlow == 0 ||
      closePrice == 0)
      return 0;

   // BUY
   if(fastEMA > slowEMA &&
      trendFast > trendSlow &&
      closePrice > fastEMA)
   {
      return 1;
   }

   // SELL
   if(fastEMA < slowEMA &&
      trendFast < trendSlow &&
      closePrice < fastEMA)
   {
      return -1;
   }

   return 0;
}

//====================================================================
// SIGNAL SCORE
//====================================================================

int GetSignalScore(string symbol, int direction)
{
   int score = 0;

   double fastEMA =
      GetEMA(symbol, SignalTimeframe, FastEMA, 1);

   double slowEMA =
      GetEMA(symbol, SignalTimeframe, SlowEMA, 1);

   double trendFast =
      GetEMA(symbol, TrendTimeframe, FastEMA, 1);

   double trendSlow =
      GetEMA(symbol, TrendTimeframe, SlowEMA, 1);

   double closePrice =
      iClose(symbol, SignalTimeframe, 1);

   double openPrice =
      iOpen(symbol, SignalTimeframe, 1);

   double previousClose =
      iClose(symbol, SignalTimeframe, 2);

   double atr =
      GetATR(symbol, SignalTimeframe, ATRPeriod, 1);

   if(atr <= 0)
      return 0;

   // Trend
   if(direction == 1)
   {
      if(fastEMA > slowEMA)
         score += 25;

      if(trendFast > trendSlow)
         score += 25;

      if(closePrice > fastEMA)
         score += 15;

      if(closePrice > openPrice)
         score += 10;

      if(closePrice > previousClose)
         score += 10;
   }

   if(direction == -1)
   {
      if(fastEMA < slowEMA)
         score += 25;

      if(trendFast < trendSlow)
         score += 25;

      if(closePrice < fastEMA)
         score += 15;

      if(closePrice < openPrice)
         score += 10;

      if(closePrice < previousClose)
         score += 10;
   }

   // Volatility condition
   double candleRange =
      MathAbs(closePrice - openPrice);

   if(candleRange > atr * 0.20)
      score += 15;

   return score;
}

//====================================================================
// OPEN TRADE
//====================================================================

void OpenTrade(string symbol, ENUM_ORDER_TYPE type)
{
   if(!SpreadAllowed(symbol))
      return;

   double atr =
      GetATR(symbol, SignalTimeframe, ATRPeriod, 1);

   if(atr <= 0)
      return;

   double price;

   if(type == ORDER_TYPE_BUY)
      price = SymbolInfoDouble(symbol, SYMBOL_ASK);
   else
      price = SymbolInfoDouble(symbol, SYMBOL_BID);

   double stopDistance =
      atr * ATR_SL_Multiplier;

   double takeDistance =
      atr * ATR_TP_Multiplier;

   double sl;
   double tp;

   if(type == ORDER_TYPE_BUY)
   {
      sl = price - stopDistance;
      tp = price + takeDistance;
   }
   else
   {
      sl = price + stopDistance;
      tp = price - takeDistance;
   }

   int digits =
      (int)SymbolInfoInteger(symbol, SYMBOL_DIGITS);

   sl = NormalizeDouble(sl, digits);
   tp = NormalizeDouble(tp, digits);

   double volume =
      CalculateLotSize(symbol, stopDistance);

   if(volume <= 0)
      return;

   bool result = false;

   if(type == ORDER_TYPE_BUY)
   {
      result = trade.Buy(
         volume,
         symbol,
         price,
         sl,
         tp,
         "Lumo Edge BUY"
      );
   }
   else
   {
      result = trade.Sell(
         volume,
         symbol,
         price,
         sl,
         tp,
         "Lumo Edge SELL"
      );
   }

   if(result)
   {
      Print(
         BotName,
         " opened ",
         EnumToString(type),
         " on ",
         symbol,
         " | Lot: ",
         volume,
         " | SL: ",
         sl,
         " | TP: ",
         tp
      );
   }
   else
   {
      Print(
         "Trade failed on ",
         symbol,
         " | Error: ",
         trade.ResultRetcode(),
         " ",
         trade.ResultRetcodeDescription()
      );
   }
}

//====================================================================
// LOT CALCULATOR
//====================================================================

double CalculateLotSize(string symbol,
                        double stopDistance)
{
   double balance =
      AccountInfoDouble(ACCOUNT_BALANCE);

   double riskMoney =
      balance * RiskPercent / 100.0;

   double tickSize =
      SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE);

   double tickValue =
      SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE);

   double volumeStep =
      SymbolInfoDouble(symbol, SYMBOL_VOLUME_STEP);

   double minVolume =
      SymbolInfoDouble(symbol, SYMBOL_VOLUME_MIN);

   double maxVolume =
      SymbolInfoDouble(symbol, SYMBOL_VOLUME_MAX);

   if(tickSize <= 0 ||
      tickValue <= 0 ||
      volumeStep <= 0)
      return 0;

   double lossPerLot =
      (stopDistance / tickSize) * tickValue;

   if(lossPerLot <= 0)
      return 0;

   double volume =
      riskMoney / lossPerLot;

   volume =
      MathFloor(volume / volumeStep) * volumeStep;

   volume =
      MathMax(volume, minVolume);

   volume =
      MathMin(volume, maxVolume);

   int volumeDigits = 2;

   if(volumeStep == 0.1)
      volumeDigits = 1;

   if(volumeStep == 0.01)
      volumeDigits = 2;

   if(volumeStep == 0.001)
      volumeDigits = 3;

   return NormalizeDouble(volume, volumeDigits);
}

//====================================================================
// SPREAD FILTER
//====================================================================

bool SpreadAllowed(string symbol)
{
   double ask =
      SymbolInfoDouble(symbol, SYMBOL_ASK);

   double bid =
      SymbolInfoDouble(symbol, SYMBOL_BID);

   double point =
      SymbolInfoDouble(symbol, SYMBOL_POINT);

   if(point <= 0)
      return false;

   double spread =
      (ask - bid) / point;

   return spread <= MaxSpreadPoints;
}

//====================================================================
// POSITION CHECK
//====================================================================

bool HasOpenPosition(string symbol)
{
   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      ulong ticket =
         PositionGetTicket(i);

      if(ticket == 0)
         continue;

      if(!PositionSelectByTicket(ticket))
         continue;

      string posSymbol =
         PositionGetString(POSITION_SYMBOL);

      long magic =
         PositionGetInteger(POSITION_MAGIC);

      if(posSymbol == symbol &&
         magic == MagicNumber)
      {
         return true;
      }
   }

   return false;
}

//====================================================================
// COUNT OUR POSITIONS
//====================================================================

int CountOurPositions()
{
   int count = 0;

   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      ulong ticket =
         PositionGetTicket(i);

      if(ticket == 0)
         continue;

      if(!PositionSelectByTicket(ticket))
         continue;

      long magic =
         PositionGetInteger(POSITION_MAGIC);

      if(magic == MagicNumber)
         count++;
   }

   return count;
}

//====================================================================
// TRADE MANAGEMENT
//====================================================================

void ManageOpenTrades()
{
   for(int i = PositionsTotal() - 1; i >= 0; i--)
   {
      ulong ticket =
         PositionGetTicket(i);

      if(ticket == 0)
         continue;

      if(!PositionSelectByTicket(ticket))
         continue;

      long magic =
         PositionGetInteger(POSITION_MAGIC);

      if(magic != MagicNumber)
         continue;

      string symbol =
         PositionGetString(POSITION_SYMBOL);

      double profit =
         PositionGetDouble(POSITION_PROFIT);

      //==============================================================
      // PROFIT CLOSE
      //==============================================================

      if(EnableProfitClose &&
         profit >= MinimumProfitMoney)
      {
         if(trade.PositionClose(ticket))
         {
            Print(
               BotName,
               ": profit target reached on ",
               symbol,
               ". Trade closed. Searching for next setup."
            );
         }

         continue;
      }

      //==============================================================
      // BREAK EVEN / TRAILING
      //==============================================================

      double atr =
         GetATR(symbol, SignalTimeframe, ATRPeriod, 1);

      if(atr <= 0)
         continue;

      long positionType =
         PositionGetInteger(POSITION_TYPE);

      double openPrice =
         PositionGetDouble(POSITION_PRICE_OPEN);

      double currentSL =
         PositionGetDouble(POSITION_SL);

      double currentTP =
         PositionGetDouble(POSITION_TP);

      double bid =
         SymbolInfoDouble(symbol, SYMBOL_BID);

      double ask =
         SymbolInfoDouble(symbol, SYMBOL_ASK);

      int digits =
         (int)SymbolInfoInteger(symbol, SYMBOL_DIGITS);

      // BUY
      if(positionType == POSITION_TYPE_BUY)
      {
         double profitDistance =
            bid - openPrice;

         if(EnableBreakEven &&
            profitDistance >= atr * BreakEvenATR)
         {
            double newSL = openPrice;

            if(currentSL < newSL)
            {
               trade.PositionModify(
                  ticket,
                  NormalizeDouble(newSL, digits),
                  currentTP
               );
            }
         }

         if(EnableTrailingStop)
         {
            double newSL =
               bid - atr * TrailingATR;

            if(newSL > currentSL &&
               newSL > openPrice)
            {
               trade.PositionModify(
                  ticket,
                  NormalizeDouble(newSL, digits),
                  currentTP
               );
            }
         }
      }

      // SELL
      if(positionType == POSITION_TYPE_SELL)
      {
         double profitDistance =
            openPrice - ask;

         if(EnableBreakEven &&
            profitDistance >= atr * BreakEvenATR)
         {
            double newSL = openPrice;

            if(currentSL == 0 ||
               currentSL > newSL)
            {
               trade.PositionModify(
                  ticket,
                  NormalizeDouble(newSL, digits),
                  currentTP
               );
            }
         }

         if(EnableTrailingStop)
         {
            double newSL =
               ask + atr * TrailingATR;

            if((currentSL == 0 ||
                newSL < currentSL) &&
               newSL < openPrice)
            {
               trade.PositionModify(
                  ticket,
                  NormalizeDouble(newSL, digits),
                  currentTP
               );
            }
         }
      }
   }
}

//====================================================================
// DAILY LOSS PROTECTION
//====================================================================

bool DailyLossExceeded()
{
   double balance =
      AccountInfoDouble(ACCOUNT_BALANCE);

   if(balance <= 0)
      return true;

   datetime dayStart =
      StringToTime(
         TimeToString(
            TimeCurrent(),
            TIME_DATE
         )
      );

   HistorySelect(dayStart, TimeCurrent());

   double todayProfit = 0;

   int deals =
      HistoryDealsTotal();

   for(int i = 0; i < deals; i++)
   {
      ulong deal =
         HistoryDealGetTicket(i);

      if(deal == 0)
         continue;

      long magic =
         HistoryDealGetInteger(
            deal,
            DEAL_MAGIC
         );

      if(magic != MagicNumber)
         continue;

      todayProfit +=
         HistoryDealGetDouble(
            deal,
            DEAL_PROFIT
         );

      todayProfit +=
         HistoryDealGetDouble(
            deal,
            DEAL_SWAP
         );

      todayProfit +=
         HistoryDealGetDouble(
            deal,
            DEAL_COMMISSION
         );
   }

   double lossLimit =
      balance * MaxDailyLossPercent / 100.0;

   return todayProfit <= -lossLimit;
}

//====================================================================
// TRADING HOURS
//====================================================================

bool TradingAllowed()
{
   if(!UseTradingHours)
      return true;

   MqlDateTime tm;

   TimeToStruct(TimeCurrent(), tm);

   if(StartHour < EndHour)
   {
      return tm.hour >= StartHour &&
             tm.hour < EndHour;
   }

   // Handles sessions crossing midnight
   return tm.hour >= StartHour ||
          tm.hour < EndHour;
}

//====================================================================
// DASHBOARD
//====================================================================

void DrawDashboard()
{
   string text = "";

   text += "================================\n";
   text += BotName + "\n";
   text += "Owner: " + OwnerName + "\n";
   text += "================================\n";

   text += "Scanner: ACTIVE\n";
   text += "Timeframe: " +
           EnumToString(SignalTimeframe) + "\n";

   text += "EMA: " +
           IntegerToString(FastEMA) +
           " / " +
           IntegerToString(SlowEMA) + "\n";

   text += "Open trades: " +

応答済み

1
開発者 1
評価
(2)
プロジェクト
4
0%
仲裁
0
期限切れ
0
暇
2
開発者 2
評価
(557)
プロジェクト
851
61%
仲裁
33
27% / 45%
期限切れ
24
3%
暇
パブリッシュした人: 1 code
3
開発者 3
評価
(22)
プロジェクト
30
40%
仲裁
8
25% / 38%
期限切れ
2
7%
多忙
パブリッシュした人: 8 articles, 35 codes
4
開発者 4
評価
(1)
プロジェクト
1
100%
仲裁
0
期限切れ
0
仕事中
パブリッシュした人: 2 codes
5
開発者 5
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
6
開発者 6
評価
(2)
プロジェクト
3
67%
仲裁
0
期限切れ
0
仕事中
パブリッシュした人: 2 codes
7
開発者 7
評価
(263)
プロジェクト
309
76%
仲裁
15
67% / 0%
期限切れ
6
2%
取り込み中
8
開発者 8
評価
(10)
プロジェクト
12
33%
仲裁
0
期限切れ
2
17%
仕事中
パブリッシュした人: 1 code
9
開発者 9
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
類似した注文
المطلوب موشر لتداول الذهب مجرب وقوية يعطي اشاره قوية فقط مع وقف خساره ومختبر ومجرب في حال الموافقه علي لموشر بعد التجربه لمدة ٣ ايام يتم الشراء دايم مبلغ ٢٠٠ دولار
Masoudahg1 999999+ USD
Hello world, thank you for your helping and supporting for us from your for all everyone that investments or working in this programing and supporting seven/24 hours in daily and nightly for customers
Laily Mahmudy 100000+ USD
Thank you very much and of trying supporting and helping for us and my investfolio portfolio id is:"investfolio portfolio masoudahg1 id is":"7Zk0iVh7zuytHkQ9OJSzeY" &"35VmgKWofZxWowQ7O6CL8K" https://leylimahmudi46.atlassian.net is my Atlassian programing that when I working of this programs
Hi there I need someone who will create an ea then test it .. the ea should only place order on the bid price of it breakout in 1 point using invisible buy and invisible sell,, example if bid breakout in 1 point up automatically invisible buy active then invisible stop loss at where the ask price was same in sell If the bid breakout in 1 point down automatically invisible sell active then invisible stop loss where
I’m looking for an experienced MT5/MQL5 freelancer to help install and configure several existing EAs on IC Markets MT5 accounts using a Windows VPS. The work will include setting up the EAs on separate demo accounts and later running several together on one account with different risk settings. I also need help with MT5 backtesting and strategy optimisation, including comparing different risk levels and reviewing
I am looking for someone to build me a modular auto trader in Sierra chart and an Innie builder so that I can replicate my current Algas that I already have built. I've sent examples below can you please let me know how much you would charge me. I'm pretty good at building the signals myself but I do not know how to build the ocos order entry and I'm trying to get quotes and go with the person who seems they can help
i need price action and candle logic understand programmer need for this job... first understand logic and interested please message .... first understand logic and interested please message .... 2 types of hedge entry conditions: 1 is candle based 1- when i start point ea hh candle buy entry, after ll made 2- below the previous candle hedge sell order 3- if market goes again hh, if sell order profit book again
Ea which is based on the price returning to the open or close of a 1-minute candle or zone of candles. panel on chart need too have buttons : trainding on/off close all close profit add buy stop add buy limit add sell stop add sell limit ( all to existing setups) calculating profit/loss for a single open setup and in total in account currency calculating profit/loss for a single open setup and in total in percentage
Hi, I’m looking for an experienced MQL5/MT4 developer to work on a trading BOT project. I currently have an MT4 demo environment with IC Markets for testing, but the complete strategy specifications have not yet been provided. I’d like you to first review the available project/BOT information and let me know what you would need to configure, develop, and properly forward-test it. The testing should cover entries
PEACE BOT 30+ USD
#property version "2.10" #property description "Chizzy Trend Rider - HFM-ready (hedging/netting safe)" #include <Trade/Trade.mqh> CTrade trade; //================ INPUTS =================// input double LotSize = 0.01; // Fixed lot (used if RiskPercent = 0) input double RiskPercent = 0.0; // Risk % of balance per trade (0 = use LotSize) input ulong MagicNumber = 220026; input ENUM_TIMEFRAMES TrendTF =

プロジェクト情報

予算
50+ USD
締め切り
最低 1 日

依頼者

出された注文1
裁定取引数0