MQL5 MetaTrader 5용 소스 코드 스크립트 - 3

icon

스크립트는 MQL5 프로그램을 사용하여 MetaTrader 5에서 일회성 동작을 수행하고 그 직후 차트에서 삭제됩니다. 샘플 기능으로는 거래 내역 업로드, 보고서 생성, 이메일 발송, 파일에서 데이터 다운로드 및 처리 등이 있습니다. 또한 스크립트를 사용하여 그래픽 인터페이스를 만들거나 단일 유형의 거래 작업을 신속하게 실행할 수 있습니다. 예를 들어, 모든 포지션을 즉시 닫을 수 있습니다.

MetaTrader 5에서 제공되는 스크립트를 다운로드하여 시작할 수 있습니다. 스크립트 라이브러리는 MQL5 프로그래밍을 학습할 수 있는 MetaEditor 개발 환경에서 직접 사용할 수도 있습니다.

코드를 제출하세요

Checks your trade history against common prop-firm challenge rules — profit target, max daily loss, max drawdown, consistency rule, and minimum trading days — with a clear PASS/FAIL report.

Reports, month by month, whether your symbol really has ticks or only bars - so you know which part of your backtest ran on generated ticks before you trust the curve. The Strategy Tester gives you one History Quality figure after the test has finished, and it never says which months were the problem. This script asks first.

여러 Expert Advisor를 동시에 실행하는 계정에 대한 읽기 전용 분석 기능입니다. 이 기능은 마감된 거래를 매직 넘버별로 그룹화하고, 해당 시스템들을 함께 실행했을 때 실제로 얼마나 절감되는지 측정합니다. 여기에는 단독 운용 시와 통합 운용 시의 드로다운 비교, 차트에 히트맵 형태로 표시된 쌍별 상관관계 행렬, 그리고 포트폴리오의 기간별 수익률에 대한 몬테카를로 재구성 결과가 포함됩니다.

The script prices one night of holding: for every open position and every Market Watch symbol it prints the swap per night in your account currency, the annualized cost in percent for both directions, the broker's rate-independent markup (|swap long| + |swap short| never depends on interest rates - it is pure broker margin), and the triple-swap day. Honest "n/a" where a swap mode cannot be converted reliably.

A read only MT5 script that reports broker symbol specifications, volume limits, price settings, execution modes, trading permissions, margin requirements and estimated profit values.

이 스크립트는 M1 바의 ‘spread’ 필드에서 귀하의 브로커의 실제 스프레드를 수집하여 중앙값, 90번째 및 99번째 백분위수를 가격 단위, 펑트, ATR 비율로 표시하고, 매일 각 시간대별 평균 및 최대 스프레드를 CSV 파일로 내보냅니다. 이 스크립트는 머릿속으로 추측한 “전형적인” 스프레드가 아닌, 실제 계좌의 비용을 기준으로 전략을 테스트하기 위해 필요합니다.

청산된 포지션의 거래 내역(CSV 파일 또는 동반 스크립트인 RuinExport.mq5가 현재 계좌의 거래 내역에서 자동으로 생성한 파일)을 읽어들이고, 다음 네 가지 독립적인 위험 지표를 보고합니다: 손실 발생 후 거래량 증가, 평균 가격이 더 나빠지는 중복된 동일 방향 포지션, 수익과 손실 간의 수익 비대칭성, 그리고 거래당 지정된 위험 수준에 따른 고전적인 파산 위험 추정치입니다. 이 네 가지 점수는 하나의 A~F 등급으로 통합되며, 평이한 언어로 된 권장 사항이 함께 제공됩니다. CSV 파일이 발견되지 않으면 스크립트가 재현 가능한 데모 거래 내역을 자동으로 생성하므로, 첫 실행 시에도 보고서를 확인할 수 있습니다.

Most reports give you one drawdown number - the worst one. This read-only script measures all three that matter on your own closed history: depth, duration and frequency. It prints the maximum drawdown with its peak, trough and recovery dates, the longest underwater period in days, whether you are at a new peak or how far below it and for how long, and a table of the deepest episodes with the days each took to recover. An episode is not a losing streak: it closes only when a NEW high is made, so a dip that never reclaims the old peak stays the same episode - which is what makes the duration column meaningful. Entry commissions are included and a partial close counts as one round turn, so the curve carries full cost. Optional percentage figures and CSV export. Deposits and withdrawals are excluded: this is the drawdown of your trading, not of your balance line.

Read-only MT5 script that estimates stop-distance cash loss in account currency, reserves explicit cash costs and floors volume to the broker grid. It never sends or modifies an order.

A native MQL5 tool that reconstructs closed positions from deal-level history, flags the ones closed through more than one exit, and reprices each one at its own first, last, and best exit rates to measure whether scaling out actually added value. Reports a Value-Add Ratio, a Scale Out Win Rate, an Efficiency figure, and a single-trade dependence check, combined into an A+ to F score with recommendations. Runs out of the box against a built-in demonstration data set; a companion script exports the real input file from your own account history. Pure MQL5, no external libraries.

Checks a hypothetical MT5 market or pending order against current symbol, volume, tick-size, stop-distance and filling rules without sending a trade.

Prints a privacy-conscious snapshot of the current MT5 broker, account, symbol and terminal environment to the Experts log for diagnostics and support.

전략의 우위가 실행 비용에 대해 얼마나 견고한지를 측정하는 순수 MQL5 스크립트입니다. 이 스크립트는 청산된 거래에 대한 날짜(Date), 수익(Profit), 거래량(Volume)이 포함된 CSV 파일을 읽어들이고, 각 거래의 비용을 고정 부분과 랏당 비용 부분으로 모델링합니다. 이 스크립트는 거래당 손익분기점 비용, 쿠션(순이익이 0이 되는 가정된 현실적 비용의 배수), 가정된 비용으로 재계산된 순이익 및 수익 계수, 비용이 손실로 전환되는 수익 거래의 비율, 그리고 권장 사항이 포함된 A+부터 F까지의 종합 비용 견고성 점수를 출력합니다. 파일이 없는 경우 재현 가능한 샘플을 생성하여 분석하므로, 첫 실행 시 바로 결과를 확인할 수 있습니다. 외부 라이브러리, 파이썬, AI를 전혀 사용하지 않습니다.

사용자가 설정한 위험 수준(자본금의 백분율 또는 고정 금액)과 손절 거리(포인트 또는 가격 수준)를 바탕으로 계획된 거래에 적합한 적절한 로트 크기를 계산합니다. 해당 종목의 계약 사양(틱 크기 및 가치, 최소/최대/단계별 거래량)을 반영하며, 필요한 증거금을 산정합니다.

설정 가능한 기간 동안 청산된 포지션을 CSV 파일로 내보내, Excel이나 Google 스프레드시트에서 거래 내역을 분석할 수 있도록 합니다. 내보내지는 항목은 진입 및 청산 시각과 가격(부분 체결분에 대해 거래량 가중 평균 적용), 거래량, 포인트 기준 결과, 수수료, 스왑, 순이익 및 거래 기간입니다.

단순히 “최대 드로다운” 수치뿐만 아니라 계좌의 드로다운 구조를 분석하는 네이티브 MQL5 스크립트입니다. 이 스크립트는 일일 자산 곡선(Date,DailyPnL CSV)을 읽어와 손실 구간 곡선을 재구성한 후, 이를 개별 드로다운 에피소드로 나누어 각 에피소드의 깊이, 지속 기간 및 회복 시간을 산출합니다. 그런 다음 ‘울서 지수(Ulcer Index)’, ‘페인 지수(Pain Index)’, ‘회복 계수(Recovery Factor)’ 및 마이너스 상태 지속 시간을 보고하고, 이를 하나의 회복력 점수(A+ ~ F)로 통합하여 권장 사항과 함께 ‘전문가(Experts)’ 탭에 표시합니다. 외부 라이브러리가 필요하지 않으며, 파일이 발견되지 않을 경우 샘플 곡선을 생성하므로 설치 후 바로 실행할 수 있습니다.

전략의 수익이 얼마나 집중되어 있는지, 즉 수익 우위가 폭넓게 분포되어 있는지 아니면 소수의 운 좋은 거래에 의존하고 있는지를 측정하는 네이티브 MQL5 스크립트입니다. 이 스크립트는 거래별 CSV 파일(날짜, 수익)을 읽어와 최대 규모 거래에서 발생한 순이익의 비중, 승리 거래의 지니 계수, 집중도 프로필, 최상위 몇 건의 거래를 제외하고 순이익 및 수익 계수를 재계산하는 생존 테스트, 그리고 설정 가능한 일관성 한도 대비 최대 일일 수익 등을 분석하여, 이를 집중도 및 일관성 점수(A+ ~ F)로 통합하고 권장 사항을 제공합니다. 파일이 발견되지 않으면 샘플 세트를 생성하므로 설치 후 바로 실행할 수 있습니다. 외부 라이브러리, 파이썬, AI가 필요하지 않습니다. 보조 프로그램인 ExportTrades.mq5는 사용자의 거래 내역에서 파일을 생성합니다.

XAUUSD/GOLD 심볼 설정, 스프레드, 틱 값, 계약 규모, 거래량 단위, 스톱/프리즈 레벨, 스왑 및 계정 컨텍스트를 로그와 선택적으로 CSV 파일에 기록하는 오픈소스 MT5 스크립트입니다.

마켓 워치에 있는 모든 종목에 대해 SYMBOL_TRADE_TICK_VALUE, SYMBOL_TRADE_TICK_VALUE_LOSS 및 SYMBOL_TRADE_TICK_VALUE_PROFIT을 비교하는 진단 스크립트입니다. 각 심볼을 네 가지 범주(ALL_EQUAL, TV_MATCHES_PROFIT, TV_MATCHES_LOSS, ALL_DIFFER) 중 하나로 분류하고, 집계된 요약 정보와 해석 팁을 제공합니다. EA에서 위험 기반 로트 크기 조정을 구현할 때 어떤 틱 값 속성을 기준으로 삼아야 할지 확인하는 데 유용합니다. 심볼별 전체 보고서를 MQL5/Files의 CSV 파일로 내보낼 수 있습니다.

계좌 통화로 표시된 목표 손실액(예: 포지션당 50달러)을 기준으로 모든 오픈 포지션에 손절매를 설정하는 스크립트입니다. 모든 입금 통화와 모든 외환 종목에서 작동합니다. 브로커의 스톱/프리즈 레벨을 확인합니다. 통화 변환은 자동으로 처리됩니다.

트리플 배리어 라벨링 파이프라인은 종종 임의의 상수(0.5–1.0%)나 기존의 스프레드 가정을 min_ret 임계값으로 사용합니다. 실제 왕복 거래 비용보다 낮게 설정된 임계값은 파이프라인이 비용에 의한 잡음을 거래 가능한 신호로 오인하게 만듭니다. 이렇게 라벨링된 데이터셋은 에지를 체계적으로 과대평가하게 되며, 해당 라벨을 기반으로 훈련된 모델은 진정한 시장 구조가 아닌 라벨링 방식에서 비롯된 인공적 현상에 과적합하게 됩니다. TransactionCostCollector.mq5는 이 문제의 데이터 수집 단계를 해결하는 독립형 스크립트입니다.

이익이 난 포지션 청산

Utility script that exports your MetaTrader 5 trading history to a CSV file. It automatically calculates Maximum Favorable Excursion (MFE), Maximum Adverse Excursion (MAE), and Forward Returns (Time-Based Excursions) in whole points for deep quantitative analysis in Excel. It will allow you to understand whether you close your trades too early and can help optimize overall trading execution.

The script shows the usage of L1 Trend Filter methods in MQL5 for float and double vectors on random walk simulated data.

One-click CSV export of trade history with P&L, duration & stats

Portfolio Scorer is a standalone MQL5 script that evaluates the quality of a multi-EA portfolio across three critical dimensions that most algo traders overlook. The script reads daily profit and loss data from CSV files (one per Expert Advisor), computes a full Pearson correlation matrix between every strategy pair, maps trading activity by UTC hour and weekday, detects asset class diversity, and produces a weighted composite score with a letter grade from A+ to F. How it works: The tool runs in four sequential stages. First, the Data Loader reads and validates CSV files containing daily returns for each EA in the portfolio. Second, the Correlation Engine calculates the complete NxN Pearson correlation matrix and flags pairs that exceed a configurable threshold. Third, the Coverage Analyzer maps which hours and weekdays have active trading and identifies blind spots. Fourth, the Scoring Function combines all three dimensions into a single composite score using adjustable weights.

MQL5용 NeuroPro 언어화 변환기

이 스크립트는 개발자가 MQL5를 사용하여 파일로 프로그래밍 방식으로 작업하는 방법을 보여주는 실용적인 예시입니다. 이 스크립트의 주요 목표 중 하나는 대규모 시스템에서 작업하거나 이식 가능한 독립형 프로젝트를 만들려는 개발자에게 필수적인 효과적인 프로젝트 파일 구성을 시연하는 것입니다. 이 개념은 추가 아이디어를 통해 더욱 확장하고 개선하여 고급 개발 워크플로를 지원할 수 있습니다.

Download all OHLC data history available and save it in a file, either for just one symbol or for many in Market Watch

바이낸스 시세 실시간 표시

비동기식과 동기식을 모두 가깝게 비교하는 간단한 프로그램입니다. 샘플 프로그램이므로 조건을 추가하는 등 테스트 목적에 맞게 자유롭게 수정해 보세요.

The script provides a quick estimation of an exponent/power factor for transformation of variable-length price increments into uniform distibution, that makes them a "random walk". The estimated value characterizes current symbol as more profitable when using in a particular trading strategy.

이 함수는 기간의 단축된 이름을 제공합니다. 예: "PERIOD_M1" 대신 "M1"

이 스크립트는 정보 제공으로 분류할 수 있습니다. 단순히 차트에 현재 거래 쌍에 대한 정보를 표시합니다.

이 스크립트는 입력 및 출력, 이름, 속성에 대한 인사이트를 제공하여 ONNX 모델의 구조를 검사하는 데 유용합니다. 특히 머신 러닝 애플리케이션에 사용되는 ONNX 모델의 특성을 디버깅하고 이해하는 데 유용합니다.

이 스크립트는 모든 MQL5 내장 지표 버퍼를 수집하여 분석 목적으로 CSV 파일에 저장합니다.

이 스크립트는 역사상 특정 시점의 모든 미체결 거래와 해당 손익을 인쇄하는 스크립트입니다.

이 스크립트는 오픈 포지션을 청산하도록 설계되었습니다.

이 스크립트는 현재 가격과 롤오버되는 포지션 단위로 고정된 거래량에서 고정된 손절매 및 이익실현 값을 핍 단위로 사용하여 오픈 포지션을 롤오버하도록 설계되었습니다.

이 함수는 거래를 개시하는 주요 로직을 수행합니다. 사용자가 제공한 심볼 정보와 파라미터를 기반으로 개시 가격, 이익실현가, 손절가를 계산합니다. 심볼, 거래량, 주문 유형, 편차, 코멘트, 매직넘버 등 필요한 정보가 포함된 거래 요청(MqlTradeRequest) 준비 주문 요청을 전송하고 결과를 받기 위해 OrderSend 함수를 호출합니다. SetTypeFillingBySymbol 함수: 심볼의 체결 정책에 따라 주문 체결 유형(체결 또는 종료, 즉시 또는 취소, 반환)을 결정합니다. GetMinTradeLevel 함수: 동결 수준과 심볼 정지 수준을 기준으로 최소 작동 수준을 계산합니다. 최소 수준이 특정 한도 내에 있는지 조정하고 그 결과를 반환합니다.

1234567891011