// ═══ MT5 跟單網站:每根 K 收盤回報策略權益與部位(部位同步建議加;貼在策略最後面,不影響回測)═══ // 為什麼:警報在 TradingView 伺服器上用自己的歷史從頭算,strategy.equity 跟策略測試器(尤其 Deep Backtesting)不一樣, // 部位大小又是照權益算的。網站用這裡回報的權益換算;差超過 10% 或部位對不上就自動重新同步所有訂閱者。 // 警報觸發要選「Order fills and alert() function calls」,Webhook 一樣填網站網址。 brCh = input.string("", "Bridge 頻道 ID(空白 = 不送)", group = "⑨ MT5 跟單網站") if brCh != "" and barstate.isrealtime and barstate.isconfirmed alert('{"k":"' + brCh + '","type":"equity","bt":' + str.tostring(time_close) + ',"eq":' + str.tostring(strategy.equity, "#.##") + ',"pos":' + str.tostring(strategy.position_size, "#.########") + ',"avg":' + str.tostring(nz(strategy.position_avg_price), "#.########") + ',"px":' + str.tostring(close, "#.########") + '}', alert.freq_once_per_bar_close)