Files
mt5-tools/__pycache__/view_trade_analysis.cpython-314.pyc
T

162 lines
25 KiB
Plaintext
Raw Normal View History

2026-04-12 18:25:46 +10:00
+
2026-04-14 08:39:30 +10:00
oÝi#MăóćRt^RIt^RIHt^RIt^RIt]PP^]PP]PP] 444^RI
2026-04-12 18:25:46 +10:00
HtHtRtRtR#)uk
pages/trade_analysis.py
=======================
MT5 Trade Analysis page — migrated from main dashboard.
2026-04-14 08:39:30 +10:00
N)Údetect_and_parseÚ
calc_statscór^RIpVP4pRVP9dRVP9d
VR,VR&RVP9dRVP9d
VR,VR&RVP9dRVR&RVP9dRVR&R VP9dRVR &R
VP9dRVR
&R VP9d!RVP9dVR,^8„VR &R VP9d„VPVR ,R
R7VR &RVP9d%VR ,PP 4VR&RVP9d!VR ,PP VR&RVP9dVPVR,R
R7VR&RVP9dkR VP9dZRVP9dIVR,VR ,,
PP4^<, P^4VR&V#)zFMap IC Markets DataFrame columns to the schema expected by calc_stats.NÚ symbol_baseÚstrategyÚ
net_profitÚprofitÚ
commissiongÚswapÚslÚtpÚwinÚ open_timeÚcoerce)ÚerrorsÚ day_of_weekÚhourÚ
close_timeÚ duration_min) ÚpandasÚcopyÚcolumnsÚ to_datetimeÚdtÚday_namerÚ
total_secondsÚround)ÚdfÚpdÚouts& Ú+C:\Users\pc\MT5Tools\view_trade_analysis.pyÚ
_normalise_icr!ăŘ
Ź'‰')€Cđź Ô
¸#ż+ą+Ô(EŘ,J‰Řs—{" x°s·{±{Ô'BŘ)H‰
Ř3ź;™;ÔŘ
S—[‘[Ô ŘF‰ Ř 3—;‘;ÔŘD‰ Ř 3—;‘;ÔŘD‰ ŕ C—K‘KÔ L°C·K±KÔ$?ŘŐŃ*E‰
ŕc—kź>™>¨#¨kŐ*:Ŕ8LŘ  § ˇ Ô +Ř!$ [Ő!1×!4Ń!4×!=Ń!=Ó!?C
Ń Ř źÔ 2C‰KŘs—{źN™N¨3¨|Ő+<ŔXNŘSź[™[Ô(¨[¸CżKąKÔ-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"RB8XEd\IVR3,PK4PM4PO44p+V+'g\PZ!RL4EM”\P\!RM4.p,V+F„p-WfR3,V-8H,p.\YV.4p/V,P_RNV-ROV/RP,RQV/RR,RSV/RT,RUV/RV,RWV/RX,RYV/RZ,R[V/R\,R]V/R^,R_V/R`,/
4K† \aRa4PcV,4PeRQRbRc7p0\Pf!V0PhPkV'.RzORd7R R Re7\P>!4\P:!RfV+4p1V1'd„WfR3,V18H,p.\YV.4p/V#!V/V14V$!V.V1 Rg24\P!^4wp)p*V);_uu_4V%!V.4RRR4V*;_uu_4V&!V.4RRR4EMÚEMŘV"RC8XE\IVR0,PK4PM4PO44p2.p,V2Frp-WfR0,V-8H,p.\YV.4p/V,P_R1V-ROV/RP,RQV/RR,RSV/RT,RUV/RV,RWV/RX,RYV/RZ,R[V/R\,/4Kt \aRa4PcV,4PeRQRbRc7p0\Pf!V0PhPkV'.RzORd7R R Re7\P:!RhV24p1V1'dWfR0,V18H,p.\YV.4p/V#!V/V14V$!V.V1 Rg24\P!^4wp)p*V);_uu_4V%!V.4RRR4V*;_uu_4V&!V.4RRR4MMV"RD8XdV%!V4V&!V4\P>!4\Pl!Ri4;_uu_4.R{Op3V3U4u.uFp4V4VP9gKV4NK p3p4Rkp5\Pf!VV3,PhPkV5RRRj.Rd7R R RlRm7\Pn!RnVV3,PqRbRo7RpV RqV R2RrRs7RRR4R# +'giE
2026-04-12 18:25:46 +10:00
L;i +'giE L“;i \,d(p
2026-04-14 08:39:30 +10:00
\P"!RT
2026-04-12 18:25:46 +10:00
R24RpRp
?
E LORp
2026-04-14 08:39:30 +10:00
?
2026-04-12 18:25:46 +10:00
ii;i \0dMp
\P"!R T
24^RIp\P4!TP744Rp
?
E
LłRp
?
ii;i +'giEL;i +'giEL4;i +'giELŕ;i +'giEL©;i +'giEL ;i +'giEL ;i +'giEL;i +'giEL3;i +'giEL{;i +'giEL[;iuup4i +'giR#;i)|u📊 Trade AnalysisÚta_dfNÚ ta_formatÚ ta_accountsÚ ta_ic_bytesz File sourcezMT5 / Quant AnalyzerzIC Markets XLSXTÚ ta_source)Ú
horizontalÚkeyz<br>)Úunsafe_allow_htmlu
đź—‘ ClearÚta_clear)r*z2Upload MT5 Report (HTM/HTML) or Quant Analyzer CSVÚ ta_upload)Útyper*ú.csvu âś“ Loaded u trades — u,Could not parse report — check file formatz*Please upload a .htm, .html, or .csv file.z*Upload IC Markets Position History (.xlsx))Úget_icmarkets_accountsÚparse_icmarkets_xlsxuHicmarkets_parser.py not found — ensure it is in the MT5Tools folder. (Ú)uJNo accounts found — check this is an IC Markets Position History export.)Úaccountz account(s) foundzError parsing file: zPlease upload an .xlsx file.z All accountsÚAccountÚ
ta_ic_account)r1
<div class="info-card">
Upload an MT5 account history report (.htm/.html), MT5 backtest report,
or a Quant Analyzer CSV export to begin analysis.
</div>
zFormat detected: **u** · z
total tradesrÚFromÚta_from)ÚvalueÚ min_valueÚ max_valuer*ÚToÚta_toÚsymbolÚSymbolÚta_symrz
Strategy / EAÚta_stratz Day of weekÚta_daysÚTypeÚbuyÚsellÚta_typerr.z
2026-04-14 08:39:30 +10:00
Showing **z** trades after filtersz
Analysis modeÚOverallú By Strategyú By SymbolúBy Day of WeekÚta_modecó(V'd\P!RV R24\P!^4wr#rEpVPRRVR,R
24VPRVR, R24VPRVR , 4VPR
VR , 4VPR RVR
2026-04-12 18:25:46 +10:00
,R
2026-04-14 08:39:30 +10:00
24\P!^4wr#rEpVPRVR,4VPRRVR,R
2026-04-12 18:25:46 +10:00
24VPRRVR,R
24VPRRVR,R
24VPRRVR,R
24\P!^4wr#rEpVPRVR,4VPRVR,4VPRVR, R24VPRVR , R24VPR!RVR",R
24\P!^4wr#rEVPR#VR$,4VPR%VR&, R24VPR'VR(,4VPR)VR*, R24R+#),z**ú
2026-04-14 08:39:30 +10:00
Net ProfitÚ$rz,.2fzWin RateÚwin_rateÚ
Profit FactorÚ
profit_factorz R:R RatioÚrr_ratioÚ
ExpectancyÚ
expectancyz Total TradesÚ total_tradeszAvg WinÚavg_winzAvg LossÚavg_lossúMax DDÚ max_drawdownz
Best TradeÚ
2026-04-12 18:25:46 +10:00
best_tradezMax Consec WinsÚmax_consec_winszMax Consec LossesÚmax_consec_lossesz Avg Win DurÚavg_win_durationÚmz Avg Loss DurÚavg_loss_durationz Worst TradeÚ worst_tradez Long TradesÚ long_tradesz
Long Win RateÚ
long_win_ratez Short TradesÚ short_tradeszShort Win RateÚshort_win_rateN)ÚstÚmarkdownrÚmetric)ÚstatsÚlabelÚc1Úc2Úc3Úc4Úc5s&& r Ú render_statsÚrender.<locals>.render_statsÍsKß Ü ŹKŠK"UG 2Ô źZšZ¨Ř
Ź ‰ , Q u¨\Ő':¸4Đ&@Đ#AÔ
Ź ‰ * e¨JŐ&7Đ%8¸Đ#:Ô
Ź ‰ / e¨OŐ&<Đ%=Ô
Ź ‰ + e¨JŐ&7Đ%8Ô
Ź ‰ , Q u¨\Ő':¸4Đ&@Đ#AÔźZšZ¨Ř
Ź ‰ . Ő#8Ô
Ź ‰ ) Q u¨YŐ'7¸Đ&=Đ#>Ô
2026-04-14 08:39:30 +10:00
Ź ‰ * Q u¨ZŐ'8¸Đ&>Đ#?Ô
Ź ‰ ( Q u¨^Ő'<¸TĐ&BĐ#CÔ
2026-04-12 18:25:46 +10:00
Ź ‰ , Q u¨\Ő':¸4Đ&@Đ#AÔźZšZ¨Ř
2026-04-14 08:39:30 +10:00
Ź ‰ Đ# uĐ->Ő'?Ô
Ź ‰ Đ% uĐ-@Ő'AÔ
Ź ‰ -¨%Đ0BŐ*CĐ)DŔAĐ'FÔ
Ź ‰ .¨%Đ0CŐ*DĐ)EŔQĐ'GÔ
Ź ‰ ¨5°Ő+?ŔĐ*EĐ'FÔźš AŘ
Ź ‰ - Ő#7Ô
Ź ‰ / e¨OŐ&<Đ%=¸QĐ#?Ô
Ź ‰ . Ő#8Ô
2026-04-12 18:25:46 +10:00
Ź ‰ Đ" eĐ,<Ő&=Đ%>¸aĐ#@ÖAr"cóčVPR4P4pVR,P4VR&\P!4pVP \P !VR,VR,R\R^R7RRRR 74VPVR
2026-04-14 08:39:30 +10:00
R R \R R
R7\RR7\RRR7\^<^^(^(R7R7\P!VRR7R#)rrÚ
cumulativeÚlinesz#7c6af7)ÚcolorÚwidthÚtozeroyzrgba(124,106,247,0.08)ÚEquity)ÚmodeÚlineÚfillÚ fillcolorÚnamei,úrgba(10,10,15,1)ú#aaazJetBrains Mono)rtÚfamilyúrgba(255,255,255,0.04)©Ú gridcolorrM©r„Ú
tickprefix©Úb)ÚtitleÚheightÚ plot_bgcolorÚ
paper_bgcolorÚfontÚxaxisÚyaxisÚmarginT©Úuse_container_widthN) Ú sort_valuesrÚcumsumÚgoÚFigureÚ add_traceÚScatterÚdictÚ
update_layoutreÚ plotly_chart)Údf_plotriÚdf_sÚfigs&& r Úrender_equity_curveÚ#render.<locals>.render_equity_curveěs×Ř×" 0×7Ř! 8ÜŹiŠi‹kŘ Ź
”b—j  Ő$6ŘÜI¨QÔŘô

ô đ ×ŃŘ ŘFĐ+;ÔĐ!9ÔĐ!9ŔcÔ"  b¨BÔ ô
ô ŹŠ°×6r"cóx.ROpVPR4PR R!RR3R7PVUu.uF"q"VR,P49gK VNK$ up4pWR,,PR4R,P 4PVP
^R7pWR,(,PR4R,P 4PVP
^R7p\ P!4pVP\ P!VP
2026-04-12 18:25:46 +10:00
VRRR 74VP\ P!VP
VR
R R 74VPR R
RRR\RR7\^<^^(^(R7\RR7\RRR7\RR7R7
\P!VRR7VP4p.R"OVnVR,P!^4VR&\P"!VRRR7R#uupi)#ÚMondayrrr
2026-04-14 08:39:30 +10:00
cóD\VP4^d,^4#)éd)rÚmean)rxs&r Ú<lambda>Ú2render.<locals>.render_dow_chart.<locals>.<lambda>s¬5°·±ł¸¸qÔ+Ar")ÚtradesrrN©Ú
2026-04-12 18:25:46 +10:00
fill_valueÚProfitúrgba(45,198,83,0.8)©rxryr~Ú marker_colorÚLossúrgba(230,57,70,0.8)zP&L by Day of WeekéÚrelativerr€©rtr‡rrrMr…úrgba(0,0,0,0.3)©Úbgcolor©
ÚbarmoderŽrr“rrÚlegendTr”rL©r•Ú
hide_indexN)ÚTuesdayÚ WednesdayÚThursdayÚFridayÚSaturdayÚSunday©rÚcount©rÚsum)ÚDayÚTradesrLú
Win Rate %)ÚgroupbyÚaggÚreindexÚuniquerČÚindexrr™ÚBarrťreÚ reset_indexrrÚ dataframe)Ú dow_orderÚdowÚwins_dowÚ
losses_dowrˇrs& r Úrender_dow_chartÚ render.<locals>.render_dow_chartÚ\ ŘŹo‰oŃ!AĐ
÷ ‰'™iÓP™i°¸
Ő0F×0MŃ0MÓ0OŃ+O—11™iŃ
đ  Uť^Ő,×4°]ÓCŔLŐQ×W×_Đ`c×`iŃ`iĐvwĐxŘ eťn5°mÓDŔ\ŐR×X×`Đad×ajŃajĐwxĐy
äŹiŠikŘ Ź
”b—ffsźy™y¨H¸XĐTiÔ Ź
”b—ffsźy™y¨J¸VĐTiÔ ×ŃŘ&¨s¸+Đ;MÜ#¬D°2¸¸rŔRÔ,HÜĐ!9ÔĐ!9ŔcÔĐ 1Ô
ô
ô ŹŠ°Ő
2026-04-14 08:39:30 +10:00
Ź_‰_Ó
2026-04-12 18:25:46 +10:00
ÚBŚ
2026-04-14 08:39:30 +10:00
Ř+×1°!Ó4Ü
2026-04-12 18:25:46 +10:00
Ź Š R¨T¸d×Cůň+Qs ¸H7ÁH7cóNVPR4PRRR7pWR,,PR4R,P4PVP^R7pWR,(,PR4R,P4PVP^R7p\
P !4pVP\
2026-04-14 08:39:30 +10:00
P!VPVRRR74VP\
2026-04-12 18:25:46 +10:00
P!VPVRR R74VPR
R R R
R
2026-04-14 08:39:30 +10:00
\RR7\^<^^(^(R7\RRR7\RRR7\RR7R7
\P!VRR7R#)rr)rr
r˛zP&L by Hour of Dayr´rr€r‡rz
Hour (UTC))r„rMr…r¸Tr”NrĹ)
2026-04-12 18:25:46 +10:00
rr™re)ÚhourlyÚwins_hÚlosses_hrˇs& r Úrender_hour_chartÚ!render.<locals>.render_hour_chart sSŘ Ó
đ 5ť>Ő*×2°6Ó:¸H×N×VĐW]×WcŃWcĐpqĐrŘ EťN3°FÓ;¸I×O×WĐX^×XdŃXdĐqrĐsäŹiŠikŘ Ź
”b—f’fvź|™|°ŔĐWlÔ Ź
2026-04-14 08:39:30 +10:00
”b—f’fxź~™~°ŔĐWlÔ ×ŃŘ&¨s¸+Đ;MÜ#¬D°2¸¸rŔRÔ,HÜĐ!9ŔÔĐ!9ŔcÔĐ 1Ô
ô
ô ŹŠ°×6r"có†\\V4PRR44pV^8”dR#V^8dR#R# R#;i)Úú$background-color: rgba(0,180,0,0.12)ú$background-color: rgba(180,0,0,0.12))ÚfloatÚstrÚreplace©ÚvalÚvs& r Ú
colour_profitÚrender.<locals>.colour_profit5sJđ Ü”c#“h×& s¨BÓ01ŚuŃ1ŚuŃCřđ Ř Ůús
+;Ż;»AzOverall StatisticszNo strategies foundzStrategy ComparisonÚStrategyrĘrUrLrrNrPrQzR:RrRrSrTrXrYz Max Consec Wr[z Max Consec Lr\rF)Ú ascending)Úsubsetr˝zSelect strategy for detailu — Equity CurvezSelect symbol for detailz