記事「プロップファームチャレンジをクリアするための自動リスク管理」についてのディスカッション

 

新しい記事「プロップファームチャレンジをクリアするための自動リスク管理」はパブリッシュされました:

本記事では、GOLD向けのプロップファーム用エキスパートアドバイザー(EA)の設計について解説します。このEAは、ブレイクアウトフィルター、マルチタイムフレーム分析、堅牢なリスク管理、そして厳格なドローダウン制御を特徴としています。ルール違反を回避し、ボラティリティの高い市場環境下でも安定した取引実行を維持することで、トレーダーがプロップファームのチャレンジをクリアするのを支援します。

本記事は、近年登場したプロップファームトレーディングという現象に対応することを唯一の目的として執筆されたものです。プロップファームトレーディングは、非常にニッチでありながら収益性が高く魅力的な取り組みですが、この道に進むと多くの課題や障害に直面します。プロップファームのチャレンジに挑戦する多くのトレーダーが直面する最も一般的な障害は、戦略や手法、スキルの不足ではなく、むしろプロップファームが定める厳格な制限や取引ルールにあります。これらを遵守しなければ、トレーダーはライブ口座の運用資格を証明することができません。

実際のところ、トレーダーは市場分析ができ、プランを守り、注文を実行し、トレンドを把握することもできます。これは自己資金での取引には十分かもしれませんが、プロップファーム取引では不十分です。プロップファームでは、定められたルールや制限を厳格に守ることが求められます。

最も一般的なルール、目標、制限事項は以下のとおりです。

  • 設定された日次ドローダウン制限を超えてはいけません。この制限は通常、深夜にリセットされます。制限値はプロップファームごとに異なり、購入した口座の種類もドローダウン制限に影響する場合があります。
  • 設定された総ドローダウン制限に違反してはいけません。これに違反すると、その口座での取引は停止されます。制限はプロップファームや口座タイプによって異なります。  
  • ニュース発表時の急激で激しい市場の値動きを利用しようとする取引は避けるべきです。方向性の欠如や不安定な価格変動により、口座にとって非常に危険で高いリスクを伴う可能性があります。
  • トレーダーは、安定した資産曲線を維持するために、取引期間を通じて同一のリスクプロファイルとエクスポージャーを維持する必要があります。これは、過度なレバレッジや一度の取引に全てを賭ける行為を防ぐためです。 
  • トレーダーは日々規律を持って取引をおこなう必要があり、プロップファームや口座にリスクをもたらす行為や、アービトラージ取引や高頻度取引といった不適切な手法に関与してはいけません。


作者: Eugene Mmene

 
Breakout_and_Risk_manager_EA.mq5
Trade.mqh
Object.mqh
StdLibErr.mqh
OrderInfo.mqh
HistoryOrderInfo.mqh
PositionInfo.mqh
DealInfo.mqh
idenfitier 'SymbolName' already used Breakout_and_Risk_manager_EA.mq5 41 8
   built-in 'SymbolName' 0
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 83 18
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 85 18
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 86 45
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 88 31
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 88 21
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 89 51
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 106 37
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 106 27
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 107 41
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 107 31
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 108 39
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 108 29
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 116 29
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 116 19
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 117 29
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 117 19
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 206 96
implicit conversion from 'unknown' to 'string' Breakout_and_Risk_manager_EA.mq5 206 85
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 241 164
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 241 154
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 241 216
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 241 206
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 253 51
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 253 41
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 255 177
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 255 167
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 262 67
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 262 57
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 262 99
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 262 131
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 262 121
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 262 89
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 263 53
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 263 84
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 263 74
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 263 43
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 263 149
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 263 139
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 270 52
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 270 42
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 275 39
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 277 51
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 284 52
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 284 42
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 289 40
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 291 51
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 143 93
implicit conversion from 'unknown' to 'string' Breakout_and_Risk_manager_EA.mq5 143 83
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 147 75
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 306 94
implicit conversion from 'unknown' to 'string' Breakout_and_Risk_manager_EA.mq5 306 83
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 313 103
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 313 93
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 313 146
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 313 136
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 323 35
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 329 35
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 336 47
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 336 37
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 356 35
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 434 35
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 434 25
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 465 34
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 465 59
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 465 49
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 465 24
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 466 46
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 466 36
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 472 32
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 472 56
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 472 46
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 472 22
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 473 46
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 473 36
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 479 47
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 479 37
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 482 47
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 482 37
open parenthesis expected Breakout_and_Risk_manager_EA.mq5 483 47
implicit conversion from 'number' to 'string' Breakout_and_Risk_manager_EA.mq5 483 37
47 errors, 34 warnings 47 34

Mql5のソースコードを ダウンロードしたのですが、それは大変な作業でした。

どうすれば修正できるでしょうか?

 

文字列 TradeSymbol = _Symbol を置き換える;

次に、SymbolNameをTradeSymbolに置き換える。

 
Austin Reade ソースコードを ダウンロードしたのですが、それは大変な作業でした。

どうすれば修正できるでしょうか?

エラーの原因がわかったので、デバッグして再度アップロードします。
 
Laurent Xavier Richer #:

置換文字列 TradeSymbol = _Symbol;

次に、SymbolNameをTradeSymbolに置き換えます。

スポット
 
#property copyright "Copyright 2025, Crystal Forex"
#property link ""
#property version   "1.50"
#property description "🚀プロップ会社を圧倒する:XAUUSD専用に設計され、課題を粉砕する。"
#property description "🛡️ インスティテューショナル・プロテクション: ハードコード化されたドローダウンとエクイティ・ガードにより、ルール違反は絶対にありません。"
#property description "📈適応型ブレイクアウト:スマート・ニュース・フィルターとマルチタイムフレーム・ロジックが金の大きな動きを捉える。"
#property description "💰ファンドレディ:トレーディングをプロのキャリアに変えるための完全自動化された規律"

#include <Trade\Trade.mqh>

//+------------------------------------------------------------------+
//| 入力パラメータ|
//+------------------------------------------------------------------+
input group "Risk Management"
input double RiskPct = 2.0;               // 取引ごとの基本リスク
input double MaxLossUSD = 110.0;          // 米ドル建て取引ごとの最大損失額(ハードキャップ)
input double DailyDDLimit = 2.5;          // 1日のドローダウンの上限 (%)
input double OverallDDLimit = 5.5;        // 全体的なドローダウンの限度 (%)
input double TargetBalanceOrEquity = 108000.0; // チャレンジ合格目標

input group "Strategy Settings"
input int    ATR_Prd = 14;                // ATR期間
input int    Brk_Prd = 10;                // ブレイクアウト・ルックバック(小節)
input double MinBrkStr = 0.1;             // 最低ブレイクアウト強度(ATR倍率)
input int    EMA_Prd = 20;                // トレンドフィルターのEMA期間
input bool   useHTF = true;               // HTF (D1/H4) 方向フィルタを使用する。

input group "News Filter"
input bool   NewsFilt = true;             // ニュースフィルターを有効にする
input int    NewsPause = 15;              // ニュースの前後で一時停止する時間

//+------------------------------------------------------------------+
//| グローバル変数|
//+------------------------------------------------------------------+
double CurRisk = RiskPct;
double LastEqHigh = 0;
double StartingBalance = 0;
double DailyBalance = 0;
datetime LastDay = 0;
bool ProfitTargetReached = false;
bool DailyDDReached = false;
double dynBrkStr = MinBrkStr; 

CTrade trade;
int h_ema_d1 = INVALID_HANDLE;
int h_ema_h4 = INVALID_HANDLE;
string WorkSymbol; // 組み込みのSymbolName()関数との衝突を避けるため、名前を変更しました。

// 時間枠固有のデータの構造
struct TimeframeData {
   ENUM_TIMEFRAMES tf;
   int h_atr;
   datetime lastSig;
   datetime lastBar;
};
TimeframeData tfs[];

// ニュース・イベントの構成
struct NewsEvt {
   datetime time;
   int impact; // 0=低、1=中、2=高
};
NewsEvt newsCal[];
int newsCnt = 0;

//+------------------------------------------------------------------+
//| エキスパート初期化関数|
//+------------------------------------------------------------------+
int OnInit()
{
datetime ExpiryDate = D'2025.12.30'; // ここに有効期限を設定 (YYYY.MM.DD)
   
   if(TimeCurrent() > ExpiryDate)
   {
      Alert("Trial Expired! Please contact the developer: https://www.mql5.com/ja/users/jawadtrader22/seller");
      Print("Trial Expired! Please contact the developer.");
      return(INIT_FAILED); // これはEAの初期化を停止する。
   }
   if(AccountInfoDouble(ACCOUNT_BALANCE) < 100.0) {
      Print("Error: Balance too low for Prop Firm logic.");
      return(INIT_FAILED);
   }

   WorkSymbol = _Symbol;
   if(!SymbolSelect(WorkSymbol, true)) {
      Print("Failed to select symbol.");
      return(INIT_FAILED);
   }

   StartingBalance = AccountInfoDouble(ACCOUNT_BALANCE);
   LastEqHigh = AccountInfoDouble(ACCOUNT_EQUITY);
   DailyBalance = StartingBalance;
   LastDay = (datetime)(TimeCurrent() / 86400 * 86400); 

   ArrayResize(tfs, 2);
   tfs[0].tf = PERIOD_M15;
   tfs[1].tf = PERIOD_H1;

   for(int i = 0; i < 2; i++) {
      tfs[i].h_atr = iATR(WorkSymbol, tfs[i].tf, ATR_Prd);
      tfs[i].lastBar = 0;
      if(tfs[i].h_atr == INVALID_HANDLE) {
         Print("Failed to create ATR handle.");
         return(INIT_FAILED);
      }
   }

   h_ema_d1 = iMA(WorkSymbol, PERIOD_D1, EMA_Prd, 0, MODE_EMA, PRICE_CLOSE);
   h_ema_h4 = iMA(WorkSymbol, PERIOD_H4, EMA_Prd, 0, MODE_EMA, PRICE_CLOSE);

   if(h_ema_d1 == INVALID_HANDLE || h_ema_h4 == INVALID_HANDLE) {
      Print("Failed to create HTF EMA handles.");
      return(INIT_FAILED);
   }

   if(NewsFilt) FetchNewsCalendar();

   Print("EA Initialized. Target: ", DoubleToString(TargetBalanceOrEquity, 2));
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
|エキスパート初期化関数|
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   IndicatorRelease(h_ema_d1);
   IndicatorRelease(h_ema_h4);
   for(int i = 0; i < ArraySize(tfs); i++) {
      IndicatorRelease(tfs[i].h_atr);
   }
   Print("EA Deinitialized.");
}

//+------------------------------------------------------------------+
//| エキスパート・ティック機能|
//+------------------------------------------------------------------+
void OnTick()
{
   // デイリー・リセット・ロジック
   datetime currentDay = (datetime)(TimeCurrent() / 86400 * 86400);
   if(currentDay > LastDay) {
      DailyBalance = AccountInfoDouble(ACCOUNT_BALANCE);
      LastDay = currentDay;
      DailyDDReached = false;
      Print("New Day. Daily Balance Reset to: ", DoubleToString(DailyBalance, 2));
   }

   // --- プロップ・ファーム・チェック ---
   if(DailyDDReached || ProfitTargetReached) return;

   double equity = AccountInfoDouble(ACCOUNT_EQUITY);
   double balance = AccountInfoDouble(ACCOUNT_BALANCE);

   if(balance >= TargetBalanceOrEquity || equity >= TargetBalanceOrEquity) {
      CloseAllPositions();
      ProfitTargetReached = true;
      Print("PROFIT TARGET REACHED! Trading Stopped.");
      return;
   }

   double dailyDD = (DailyBalance - equity) / DailyBalance * 100.0;
   double overallDD = (StartingBalance - equity) / StartingBalance * 100.0;

   if(dailyDD >= DailyDDLimit || overallDD >= OverallDDLimit) {
      CloseAllPositions();
      DailyDDReached = true;
      Print("DRAWDOWN LIMIT BREACHED! Daily: ", DoubleToString(dailyDD, 2), "%, Overall: ", DoubleToString(overallDD, 2), "%");
      return;
   }

   // ニュース更新
   static datetime lastNewsFetch = 0;
   if(NewsFilt && TimeCurrent() >= lastNewsFetch + 4*3600) {
      FetchNewsCalendar();
      lastNewsFetch = TimeCurrent();
   }
   if(NewsFilt && IsNews()) return;

   // --- ストラテジー・ループ
   for(int i = 0; i < ArraySize(tfs); i++) 
   {
      ManageTrades(tfs[i].tf);

      if(!NewBar(tfs[i].tf, tfs[i].lastBar)) continue;

      if(PositionsTotal() < 5) 
      {
         double atrVal = GetIndicatorVal(tfs[i].h_atr, 0);
         
         bool buySignal = BuyBrk(tfs[i].tf) && (!useHTF || BullTrend());
         bool sellSignal = SellBrk(tfs[i].tf) && (!useHTF || BearTrend());

         if(buySignal) {
             double sl = SymbolInfoDouble(WorkSymbol, SYMBOL_ASK) - (atrVal * 1.5);
             double tp = SymbolInfoDouble(WorkSymbol, SYMBOL_ASK) + (atrVal * 3.0);
             double lots = CalcLots(MathAbs(SymbolInfoDouble(WorkSymbol, SYMBOL_ASK) - sl));
             
             if(lots > 0) {
                 trade.SetExpertMagicNumber(MagicNumber(tfs[i].tf));
                 trade.Buy(lots, WorkSymbol, 0, sl, tp, "Gold Breakout Buy");
             }
         }
         else if(sellSignal) {
             double sl = SymbolInfoDouble(WorkSymbol, SYMBOL_BID) + (atrVal * 1.5);
             double tp = SymbolInfoDouble(WorkSymbol, SYMBOL_BID) - (atrVal * 3.0);
             double lots = CalcLots(MathAbs(sl - SymbolInfoDouble(WorkSymbol, SYMBOL_BID)));
             
             if(lots > 0) {
                 trade.SetExpertMagicNumber(MagicNumber(tfs[i].tf));
                 trade.Sell(lots, WorkSymbol, 0, sl, tp, "Gold Breakout Sell");
             }
         }
      }
   }
}

//+------------------------------------------------------------------+
//| ヘルパー関数|
//+------------------------------------------------------------------+
double CalcLots(double slPointsDistance)
{
   if(slPointsDistance <= 0) return 0.0;
   double accountBalance = AccountInfoDouble(ACCOUNT_BALANCE);
   double riskMoney = accountBalance * (CurRisk / 100.0);
   if(riskMoney > MaxLossUSD) riskMoney = MaxLossUSD; // ハードキャップ
   
   double tickValue = SymbolInfoDouble(WorkSymbol, SYMBOL_TRADE_TICK_VALUE);
   double tickSize = SymbolInfoDouble(WorkSymbol, SYMBOL_TRADE_TICK_SIZE);
   if(tickValue == 0 || tickSize == 0) return 0.0;
   
   double lots = riskMoney / ( (slPointsDistance / tickSize) * tickValue );
   double minLot = SymbolInfoDouble(WorkSymbol, SYMBOL_VOLUME_MIN);
   double maxLot = SymbolInfoDouble(WorkSymbol, SYMBOL_VOLUME_MAX);
   double stepLot = SymbolInfoDouble(WorkSymbol, SYMBOL_VOLUME_STEP);
   
   lots = MathFloor(lots / stepLot) * stepLot;
   if(lots < minLot) return 0.0;
   if(lots > maxLot) lots = maxLot;
   return lots;
}

void ManageTrades(ENUM_TIMEFRAMES tf)
{
   for(int i = PositionsTotal()-1; i >= 0; i--)
   {
      ulong ticket = PositionGetTicket(i);
      if(!PositionSelectByTicket(ticket)) continue;
      if(PositionGetString(POSITION_SYMBOL) != WorkSymbol) continue;
      if(PositionGetInteger(POSITION_MAGIC) != MagicNumber(tf)) continue; 

      double openPrice = PositionGetDouble(POSITION_PRICE_OPEN);
      double sl = PositionGetDouble(POSITION_SL);
      double tp = PositionGetDouble(POSITION_TP);
      double lots = PositionGetDouble(POSITION_VOLUME);
      double currentPrice = PositionGetDouble(POSITION_PRICE_CURRENT);
      long type = PositionGetInteger(POSITION_TYPE);
      
      int tfIdx = (tf == PERIOD_M15) ? 0 : 1;
      double atr = GetIndicatorVal(tfs[tfIdx].h_atr, 0);

      // 非常口
      if(type == POSITION_TYPE_BUY && SellBrk(tf)) { trade.PositionClose(ticket); continue; }
      if(type == POSITION_TYPE_SELL && BuyBrk(tf)) { trade.PositionClose(ticket); continue; }

      // パーシャルクローズ&BE
      double dist = (type == POSITION_TYPE_BUY) ? (currentPrice - openPrice) : (openPrice - currentPrice);
      if(dist > (atr * 2.5)) {
         bool isBE = (type == POSITION_TYPE_BUY && sl >= openPrice) || (type == POSITION_TYPE_SELL && sl <= openPrice);
         if(!isBE && lots >= SymbolInfoDouble(WorkSymbol, SYMBOL_VOLUME_MIN) * 2) {
             trade.PositionClosePartial(ticket, lots / 2.0);
             trade.PositionModify(ticket, openPrice, tp);
         }
      }

      // トレーリング・ストップ
      double trailDist = atr * 1.6;
      if(type == POSITION_TYPE_BUY) {
         double newSL = currentPrice - trailDist;
         if(newSL > sl && newSL < currentPrice) trade.PositionModify(ticket, newSL, tp);
      }
      else if(type == POSITION_TYPE_SELL) {
         double newSL = currentPrice + trailDist;
         if(newSL < sl || sl == 0) trade.PositionModify(ticket, newSL, tp);
      }
   }
}

bool BuyBrk(ENUM_TIMEFRAMES tf)
{
   double close1 = iClose(WorkSymbol, tf, 1);
   int highIdx = iHighest(WorkSymbol, tf, MODE_HIGH, Brk_Prd, 2);
   if(highIdx < 0) return false;
   double highVal = iHigh(WorkSymbol, tf, highIdx);
   int tfIdx = (tf == PERIOD_M15) ? 0 : 1;
   double atr = GetIndicatorVal(tfs[tfIdx].h_atr, 1);
   return (close1 > (highVal + (atr * dynBrkStr)));
}

bool SellBrk(ENUM_TIMEFRAMES tf)
{
   double close1 = iClose(WorkSymbol, tf, 1);
   int lowIdx = iLowest(WorkSymbol, tf, MODE_LOW, Brk_Prd, 2);
   if(lowIdx < 0) return false;
   double lowVal = iLow(WorkSymbol, tf, lowIdx);
   int tfIdx = (tf == PERIOD_M15) ? 0 : 1;
   double atr = GetIndicatorVal(tfs[tfIdx].h_atr, 1);
   return (close1 < (lowVal - (atr * dynBrkStr)));
}

bool BullTrend()
{
   double d1_ema = GetIndicatorVal(h_ema_d1, 1);
   double d1_close = iClose(WorkSymbol, PERIOD_D1, 1);
   return (d1_close > d1_ema);
}

bool BearTrend()
{
   double d1_ema = GetIndicatorVal(h_ema_d1, 1);
   double d1_close = iClose(WorkSymbol, PERIOD_D1, 1);
   return (d1_close < d1_ema);
}

bool IsNews()
{
   datetime now = TimeCurrent();
   for(int i=0; i<newsCnt; i++) {
       if(newsCal[i].impact < 2) continue; 
       if(now >= newsCal[i].time - (NewsPause * 60) && now <= newsCal[i].time + (NewsPause * 60)) return true;
   }
   return false;
}

void FetchNewsCalendar()
{
   // プレースホルダ:安全のためにニュースカウンタをリセットする
   newsCnt = 0; 
}

void CloseAllPositions()
{
   for(int i = PositionsTotal() - 1; i >= 0; i--) {
      ulong ticket = PositionGetTicket(i);
      if(PositionSelectByTicket(ticket) && PositionGetString(POSITION_SYMBOL) == WorkSymbol) {
         trade.PositionClose(ticket);
      }
   }
}

double GetIndicatorVal(int handle, int index)
{
   double buf[1];
   if(CopyBuffer(handle, 0, index, 1, buf) < 0) return 0.0;
   return buf[0];
}

bool NewBar(ENUM_TIMEFRAMES tf, datetime &last_bar_time)
{
   datetime curr_bar_time = iTime(WorkSymbol, tf, 0);
   if(curr_bar_time != last_bar_time) {
      last_bar_time = curr_bar_time;
      return true;
   }
   return false;
}

long MagicNumber(ENUM_TIMEFRAMES tf)
{
   if(tf == PERIOD_M15) return 1015;
   if(tf == PERIOD_H1) return 1060;
   return 1000;
}
コピーペースト完了
ファイル:
propfirm.mq5  27 kb
 
Austin Reade ソースコードを ダウンロードしたのですが、それは大変な作業でした。

どうすれば修正できるでしょうか?

修正したコードはこちらです。
ファイル:
 
Muhammad Jawad Shabir #:
完全なコピー・ペースト・コード
コードは同じではないが、結果は大きく異なる。