//+------------------------------------------------------------------+ //| XAUUSD_Hedging_EA.mq5 | //| Expert Advisor สำหรับ MT5 เทรดทองคำ (Gold)| //| กลยุทธ์ Hedging พร้อม Dashboard & Telegram Alert | //| Copyright 2026, Quant Trader| //+------------------------------------------------------------------+ #property copyright "Quant Hedging Systems" #property link "https://t.me/yourchannel" #property version "1.00" #property description "EA เทรดทองคำ XAUUSD แบบ Hedging: เริ่มต้นด้วยการรอ 30 วินาที แล้วเปิด Buy+Sell พร้อมกัน" #property description "เมื่อออเดอร์มีกำไร X% จะปิดทำกำไรทันที และเปิดออเดอร์ใหม่ในทิศทางเดิมเพื่อคานราคา" #property description "พร้อมระบบ Trailing Stop, Dashboard แสดงสถานะ, บันทึก Log ลง CSV และแจ้งเตือน Telegram" #include #include #include #include input group "=== การตั้งค่าพื้นฐาน (General Settings) ===" input double InpLotSize = 0.01; // ขนาด Lot เริ่มต้น (ไม่มีการเบิ้ลล็อต) input int InpStartDelaySeconds = 30; // เวลารอนับถอยหลังก่อนเปิดออเดอร์แรก (วินาที) input ulong InpMagicNumber = 889922; // Magic Number ประจำ EA input ulong InpSlippage = 30; // Slippage ยอมรับได้ (Points) input string InpTradeComment = "XAU_Hedge_EA"; // คอมเมนต์ของออเดอร์ input group "=== กลยุทธ์ Hedging & เป้าหมายกำไร (Hedging & Targets) ===" input double InpProfitTargetPercent = 0.5; // กำไรเป้าหมายที่ต้องการปิด (X % ของบาลานซ์) input bool InpReopenSameDirection = true; // เปิดออเดอร์ใหม่ทิศทางเดิมทันทีเพื่อคานออเดอร์ input double InpLossCloseThresholdPercent= 0.3; // เกณฑ์ปิดออเดอร์ลบ (หากลบน้อยกว่า X % หลังปิดบวก) input bool InpEnableBasketRecovery = true; // เปิดระบบปิดรวบคู่เมื่อกำไรสุทธิรวมเป็นบวก input group "=== การจัดการความเสี่ยง (SL / TP / Trailing Stop) ===" input int InpStopLossPoints = 0; // Stop Loss เป็นจำนวนจุด (0 = ปิดใช้งาน) input int InpTakeProfitPoints = 0; // Take Profit เป็นจำนวนจุด (0 = ปิดใช้งาน) input bool InpUseTrailingStop = true; // เปิดใช้งาน Trailing Stop input int InpTrailingStartPoints = 300; // Trailing Start (กำไรกี่จุดจึงเริ่มเลื่อน SL) input int InpTrailingStopPoints = 200; // Trailing Stop ระยะห่าง (จุด) input int InpTrailingStepPoints = 50; // Trailing Step ขยับทีละกี่จุด input group "=== ระบบแจ้งเตือน TELEGRAM (Telegram Alert) ===" input bool InpEnableTelegram = true; // เปิดใช้งานแจ้งเตือนผ่าน Telegram input string InpTelegramBotToken = "YOUR_BOT_TOKEN_HERE"; // Telegram Bot Token input string InpTelegramChatID = "YOUR_CHAT_ID_HERE"; // Telegram Chat ID หรือ Group ID input group "=== หน้าจอแสดงสถานะ (On-Chart Dashboard) ===" input bool InpShowDashboard = true; // แสดง Dashboard บนกราฟ input int InpDashboardX = 20; // พิกัด X ของ Dashboard input int InpDashboardY = 30; // พิกัด Y ของ Dashboard input group "=== การบันทึกไฟล์ LOG (Trade Logging) ===" input bool InpEnableFileLog = true; // บันทึกประวัติการเทรดลงไฟล์ CSV input string InpLogFileName = "XAU_HedgeEA_Logs.csv"; // ชื่อไฟล์ Log (อยู่ใน MQL5/Files) CTrade trade; CPositionInfo positionInfo; CAccountInfo accountInfo; CSymbolInfo symbolInfo; datetime g_eaStartTime = 0; bool g_initialOrdersOpened = false; int g_timerCountdown = 0; double g_totalClosedProfit = 0.0; int g_closedTradesCount = 0; string g_dashboardPrefix = "XAU_DASH_"; int OnInit() { if(!symbolInfo.Name(_Symbol)) return(INIT_FAILED); symbolInfo.RefreshRates(); trade.SetExpertMagicNumber(InpMagicNumber); trade.SetDeviationInPoints(InpSlippage); trade.SetTypeFillingBySymbol(_Symbol); g_eaStartTime = TimeCurrent(); g_timerCountdown = InpStartDelaySeconds; g_initialOrdersOpened = false; EventSetTimer(1); if(InpEnableFileLog) InitLogFile(); if(InpShowDashboard) { CreateDashboard(); UpdateDashboard(); } if(InpEnableTelegram) { string startMsg = "🚀 XAUUSD Hedging EA เริ่มทำงานแล้ว\n" + "━━━━━━━━━━━━━━━━━━\n" + "📊 Symbol: " + _Symbol + "\n" + "💰 Balance: $" + DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE), 2) + "\n" + "⏱ รอนับถอยหลัง: " + IntegerToString(InpStartDelaySeconds) + " วินาที\n" + "🎯 เป้ากำไรปิด: " + DoubleToString(InpProfitTargetPercent, 2) + "%"; SendTelegramMessage(startMsg); } Print("✅ XAUUSD Hedging EA เริ่มทำงานเรียบร้อย! Magic: ", InpMagicNumber); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { EventKillTimer(); DestroyDashboard(); if(InpEnableTelegram) { string stopMsg = "🛑 XAUUSD Hedging EA หยุดการทำงาน\n" + "💵 กำไรสะสมที่ปิดไป: $" + DoubleToString(g_totalClosedProfit, 2); SendTelegramMessage(stopMsg); } } void OnTimer() { if(!g_initialOrdersOpened) { if(g_timerCountdown > 0) { g_timerCountdown--; } else { OpenInitialDualOrders(); g_initialOrdersOpened = true; } } if(InpShowDashboard) UpdateDashboard(); } void OnTick() { if(!symbolInfo.RefreshRates()) return; if(InpUseTrailingStop) ManageTrailingStop(); CheckProfitTargetsAndHedging(); if(InpEnableBasketRecovery) CheckBasketProfitClose(); } void OpenInitialDualOrders() { double ask = symbolInfo.Ask(); double bid = symbolInfo.Bid(); double point = symbolInfo.Point(); double buySL = (InpStopLossPoints > 0) ? (ask - InpStopLossPoints * point) : 0.0; double buyTP = (InpTakeProfitPoints > 0) ? (ask + InpTakeProfitPoints * point) : 0.0; double sellSL = (InpStopLossPoints > 0) ? (bid + InpStopLossPoints * point) : 0.0; double sellTP = (InpTakeProfitPoints > 0) ? (bid - InpTakeProfitPoints * point) : 0.0; bool buySuccess = trade.Buy(InpLotSize, _Symbol, ask, buySL, buyTP, InpTradeComment + "_BUY_INIT"); ulong buyTicket = trade.ResultOrder(); if(buySuccess) { LogTrade("OPEN", buyTicket, "BUY", InpLotSize, ask, 0.0, "เปิด Buy คู่ต้นทางหลัง 30 วิ"); if(InpEnableTelegram) SendTelegramMessage("🟢 เปิดออเดอร์ [BUY] สำเร็จ\nTicket: #" + IntegerToString(buyTicket) + "\nLot: " + DoubleToString(InpLotSize, 2) + "\nราคา: " + DoubleToString(ask, symbolInfo.Digits())); } bool sellSuccess = trade.Sell(InpLotSize, _Symbol, bid, sellSL, sellTP, InpTradeComment + "_SELL_INIT"); ulong sellTicket = trade.ResultOrder(); if(sellSuccess) { LogTrade("OPEN", sellTicket, "SELL", InpLotSize, bid, 0.0, "เปิด Sell คู่ต้นทางหลัง 30 วิ"); if(InpEnableTelegram) SendTelegramMessage("🔴 เปิดออเดอร์ [SELL] สำเร็จ\nTicket: #" + IntegerToString(sellTicket) + "\nLot: " + DoubleToString(InpLotSize, 2) + "\nราคา: " + DoubleToString(bid, symbolInfo.Digits())); } } void CheckProfitTargetsAndHedging() { double balance = AccountInfoDouble(ACCOUNT_BALANCE); if(balance <= 0) return; double targetProfitMoney = balance * (InpProfitTargetPercent / 100.0); for(int i = PositionsTotal() - 1; i >= 0; i--) { if(positionInfo.SelectByIndex(i)) { if(positionInfo.Symbol() == _Symbol && positionInfo.Magic() == InpMagicNumber) { double posProfit = positionInfo.Profit(); ENUM_POSITION_TYPE posType = positionInfo.PositionType(); ulong ticket = positionInfo.Ticket(); double volume = positionInfo.Volume(); if(posProfit >= targetProfitMoney) { double closeProfit = posProfit; if(trade.PositionClose(ticket)) { g_totalClosedProfit += closeProfit; g_closedTradesCount++; string dirStr = (posType == POSITION_TYPE_BUY) ? "BUY" : "SELL"; LogTrade("CLOSE_PROFIT", ticket, dirStr, volume, positionInfo.PriceCurrent(), closeProfit, "กำไรถึงเป้า"); if(InpEnableTelegram) SendTelegramMessage("🎉 ปิดทำกำไรสำเร็จ [" + dirStr + "]\nTicket: #" + IntegerToString(ticket) + "\nกำไร: +$" + DoubleToString(closeProfit, 2) + "\nยอดกำไรสะสม: $" + DoubleToString(g_totalClosedProfit, 2)); if(InpReopenSameDirection) ReopenHedgeOrder(posType, volume); EvaluateOppositeLosingOrders(posType, closeProfit); } } } } } } void ReopenHedgeOrder(ENUM_POSITION_TYPE dir, double lot) { symbolInfo.RefreshRates(); double point = symbolInfo.Point(); if(dir == POSITION_TYPE_BUY) { double ask = symbolInfo.Ask(); double sl = (InpStopLossPoints > 0) ? (ask - InpStopLossPoints * point) : 0.0; double tp = (InpTakeProfitPoints > 0) ? (ask + InpTakeProfitPoints * point) : 0.0; if(trade.Buy(lot, _Symbol, ask, sl, tp, InpTradeComment + "_BUY_REOPEN")) { ulong newTicket = trade.ResultOrder(); LogTrade("REOPEN", newTicket, "BUY", lot, ask, 0.0, "เปิด Buy ซ้ำคานราคา"); if(InpEnableTelegram) SendTelegramMessage("🔄 เปิดคานออเดอร์ใหม่ [BUY]\nTicket: #" + IntegerToString(newTicket) + "\nLot: " + DoubleToString(lot, 2)); } } else if(dir == POSITION_TYPE_SELL) { double bid = symbolInfo.Bid(); double sl = (InpStopLossPoints > 0) ? (bid + InpStopLossPoints * point) : 0.0; double tp = (InpTakeProfitPoints > 0) ? (bid - InpTakeProfitPoints * point) : 0.0; if(trade.Sell(lot, _Symbol, bid, sl, tp, InpTradeComment + "_SELL_REOPEN")) { ulong newTicket = trade.ResultOrder(); LogTrade("REOPEN", newTicket, "SELL", lot, bid, 0.0, "เปิด Sell ซ้ำคานราคา"); if(InpEnableTelegram) SendTelegramMessage("🔄 เปิดคานออเดอร์ใหม่ [SELL]\nTicket: #" + IntegerToString(newTicket) + "\nLot: " + DoubleToString(lot, 2)); } } } void EvaluateOppositeLosingOrders(ENUM_POSITION_TYPE closedWinDirection, double closedProfitAmount) { double balance = AccountInfoDouble(ACCOUNT_BALANCE); if(balance <= 0) return; double maxLossAllowedMoney = balance * (InpLossCloseThresholdPercent / 100.0); for(int i = PositionsTotal() - 1; i >= 0; i--) { if(positionInfo.SelectByIndex(i)) { if(positionInfo.Symbol() == _Symbol && positionInfo.Magic() == InpMagicNumber) { if(positionInfo.PositionType() != closedWinDirection && positionInfo.Profit() < 0) { double lossAmount = MathAbs(positionInfo.Profit()); ulong ticket = positionInfo.Ticket(); if(lossAmount <= maxLossAllowedMoney || (InpEnableBasketRecovery && lossAmount < closedProfitAmount)) { double finalLoss = positionInfo.Profit(); string typeStr = (positionInfo.PositionType() == POSITION_TYPE_BUY) ? "BUY" : "SELL"; if(trade.PositionClose(ticket)) { g_totalClosedProfit += finalLoss; g_closedTradesCount++; LogTrade("CLOSE_LOSS_CUT", ticket, typeStr, positionInfo.Volume(), positionInfo.PriceCurrent(), finalLoss, "ตัดขาดทุนตามเงื่อนไข"); if(InpEnableTelegram) SendTelegramMessage("🛡️ ปิดออเดอร์ลบ (Hedge Cut)\nTicket: #" + IntegerToString(ticket) + " [" + typeStr + "]\nผล: -$" + DoubleToString(lossAmount, 2)); } } } } } } } void CheckBasketProfitClose() { double netFloatingProfit = 0.0; int count = 0; for(int i = 0; i < PositionsTotal(); i++) { if(positionInfo.SelectByIndex(i)) { if(positionInfo.Symbol() == _Symbol && positionInfo.Magic() == InpMagicNumber) { netFloatingProfit += positionInfo.Profit() + positionInfo.Swap(); count++; } } } double balance = AccountInfoDouble(ACCOUNT_BALANCE); double targetBasket = balance * (InpProfitTargetPercent / 100.0); if(count >= 2 && netFloatingProfit >= targetBasket) { for(int i = PositionsTotal() - 1; i >= 0; i--) { if(positionInfo.SelectByIndex(i)) { if(positionInfo.Symbol() == _Symbol && positionInfo.Magic() == InpMagicNumber) trade.PositionClose(positionInfo.Ticket()); } } g_totalClosedProfit += netFloatingProfit; if(InpEnableTelegram) SendTelegramMessage("🎯 ปิดรวบ Basket Hedging สำเร็จ!\nกำไรสุทธิรวม: +$" + DoubleToString(netFloatingProfit, 2) + ""); } } void ManageTrailingStop() { double point = symbolInfo.Point(); int digits = (int)symbolInfo.Digits(); for(int i = 0; i < PositionsTotal(); i++) { if(positionInfo.SelectByIndex(i)) { if(positionInfo.Symbol() == _Symbol && positionInfo.Magic() == InpMagicNumber) { ENUM_POSITION_TYPE type = positionInfo.PositionType(); double openPrice = positionInfo.PriceOpen(); double currentSL = positionInfo.StopLoss(); ulong ticket = positionInfo.Ticket(); if(type == POSITION_TYPE_BUY) { double bid = symbolInfo.Bid(); if((bid - openPrice) >= InpTrailingStartPoints * point) { double newSL = NormalizeDouble(bid - InpTrailingStopPoints * point, digits); if(newSL > currentSL + InpTrailingStepPoints * point || currentSL == 0) trade.PositionModify(ticket, newSL, positionInfo.TakeProfit()); } } else if(type == POSITION_TYPE_SELL) { double ask = symbolInfo.Ask(); if((openPrice - ask) >= InpTrailingStartPoints * point) { double newSL = NormalizeDouble(ask + InpTrailingStopPoints * point, digits); if(newSL < currentSL - InpTrailingStepPoints * point || currentSL == 0) trade.PositionModify(ticket, newSL, positionInfo.TakeProfit()); } } } } } } bool SendTelegramMessage(string textMessage) { if(!InpEnableTelegram) return false; if(StringLen(InpTelegramBotToken) < 10 || StringLen(InpTelegramChatID) < 3) return false; string url = "https://api.telegram.org/bot" + InpTelegramBotToken + "/sendMessage"; string headers = "Content-Type: application/json\r\n"; string jsonPayload = "{\"chat_id\": \"" + InpTelegramChatID + "\", \"text\": \"" + textMessage + "\", \"parse_mode\": \"HTML\"}"; char postData[], resultData[]; string resultHeaders; StringToCharArray(jsonPayload, postData, 0, WHOLE_ARRAY, CP_UTF8); ArrayResize(postData, ArraySize(postData) - 1); ResetLastError(); int res = WebRequest("POST", url, headers, 3000, postData, resultData, resultHeaders); return (res == 200); } void InitLogFile() { ResetLastError(); int handle = FileOpen(InpLogFileName, FILE_READ|FILE_WRITE|FILE_CSV|FILE_ANSI, ","); if(handle != INVALID_HANDLE) { if(FileSize(handle) == 0) FileWrite(handle, "Timestamp", "Ticket", "Action", "Type", "Lot", "Price", "Profit_USD", "Balance", "Notes"); FileClose(handle); } } void LogTrade(string action, ulong ticket, string typeStr, double lot, double price, double profit, string note) { if(!InpEnableFileLog) return; int handle = FileOpen(InpLogFileName, FILE_READ|FILE_WRITE|FILE_CSV|FILE_ANSI, ","); if(handle != INVALID_HANDLE) { FileSeek(handle, 0, SEEK_END); FileWrite(handle, TimeToString(TimeCurrent(), TIME_DATE|TIME_SECONDS), IntegerToString(ticket), action, typeStr, DoubleToString(lot, 2), DoubleToString(price, symbolInfo.Digits()), DoubleToString(profit, 2), DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE), 2), note); FileClose(handle); } } void CreateDashboard() { int width = 280, height = 230; string bgName = g_dashboardPrefix + "BG"; ObjectCreate(0, bgName, OBJ_RECTANGLE_LABEL, 0, 0, 0); ObjectSetInteger(0, bgName, OBJPROP_XDISTANCE, InpDashboardX); ObjectSetInteger(0, bgName, OBJPROP_YDISTANCE, InpDashboardY); ObjectSetInteger(0, bgName, OBJPROP_XSIZE, width); ObjectSetInteger(0, bgName, OBJPROP_YSIZE, height); ObjectSetInteger(0, bgName, OBJPROP_BGCOLOR, C'20,24,33'); ObjectSetInteger(0, bgName, OBJPROP_BORDER_TYPE, BORDER_FLAT); ObjectSetInteger(0, bgName, OBJPROP_BORDER_COLOR, C'212,175,55'); ObjectSetInteger(0, bgName, OBJPROP_CORNER, CORNER_LEFT_UPPER); string headerName = g_dashboardPrefix + "HEADER"; ObjectCreate(0, headerName, OBJ_RECTANGLE_LABEL, 0, 0, 0); ObjectSetInteger(0, headerName, OBJPROP_XDISTANCE, InpDashboardX); ObjectSetInteger(0, headerName, OBJPROP_YDISTANCE, InpDashboardY); ObjectSetInteger(0, headerName, OBJPROP_XSIZE, width); ObjectSetInteger(0, headerName, OBJPROP_YSIZE, 30); ObjectSetInteger(0, headerName, OBJPROP_BGCOLOR, C'33,39,56'); ObjectSetInteger(0, headerName, OBJPROP_CORNER, CORNER_LEFT_UPPER); CreateDashboardLabel(g_dashboardPrefix + "TITLE", "⚡ XAUUSD HEDGING EA", InpDashboardX + 15, InpDashboardY + 7, C'255,215,0', 10); int startY = InpDashboardY + 40, gap = 20; CreateDashboardLabel(g_dashboardPrefix + "L_STATUS", "สถานะระบบ:", InpDashboardX + 15, startY, C'160,174,192', 9); CreateDashboardLabel(g_dashboardPrefix + "V_STATUS", "Hedging Active", InpDashboardX + 140, startY, C'72,187,120', 9); CreateDashboardLabel(g_dashboardPrefix + "L_TIMER", "นับถอยหลัง:", InpDashboardX + 15, startY + gap, C'160,174,192', 9); CreateDashboardLabel(g_dashboardPrefix + "V_TIMER", "30s", InpDashboardX + 140, startY + gap, C'246,173,85', 9); CreateDashboardLabel(g_dashboardPrefix + "L_BALANCE", "Balance:", InpDashboardX + 15, startY + gap*2, C'160,174,192', 9); CreateDashboardLabel(g_dashboardPrefix + "V_BALANCE", "$0.00", InpDashboardX + 140, startY + gap*2, C'255,255,255', 9); CreateDashboardLabel(g_dashboardPrefix + "L_FLOAT", "กำไรลอยตัว:", InpDashboardX + 15, startY + gap*3, C'160,174,192', 9); CreateDashboardLabel(g_dashboardPrefix + "V_FLOAT", "$0.00", InpDashboardX + 140, startY + gap*3, C'72,187,120', 9); CreateDashboardLabel(g_dashboardPrefix + "L_CLOSED", "กำไรสะสม:", InpDashboardX + 15, startY + gap*4, C'160,174,192', 9); CreateDashboardLabel(g_dashboardPrefix + "V_CLOSED", "$0.00", InpDashboardX + 140, startY + gap*4, C'212,175,55', 9); CreateDashboardLabel(g_dashboardPrefix + "L_ORDERS", "Buy / Sell ไม้:", InpDashboardX + 15, startY + gap*5, C'160,174,192', 9); CreateDashboardLabel(g_dashboardPrefix + "V_ORDERS", "0 / 0", InpDashboardX + 140, startY + gap*5, C'99,179,237', 9); } void UpdateDashboard() { if(!InpShowDashboard) return; if(!g_initialOrdersOpened) { ObjectSetString(0, g_dashboardPrefix + "V_STATUS", OBJPROP_TEXT, "รอเวลาเริ่ม..."); ObjectSetInteger(0, g_dashboardPrefix + "V_STATUS", OBJPROP_COLOR, C'237,137,54'); ObjectSetString(0, g_dashboardPrefix + "V_TIMER", OBJPROP_TEXT, IntegerToString(g_timerCountdown) + " วินาที"); } else { ObjectSetString(0, g_dashboardPrefix + "V_STATUS", OBJPROP_TEXT, "Hedging Active"); ObjectSetInteger(0, g_dashboardPrefix + "V_STATUS", OBJPROP_COLOR, C'72,187,120'); ObjectSetString(0, g_dashboardPrefix + "V_TIMER", OBJPROP_TEXT, "เทรดปกติ"); } int buyCount = 0, sellCount = 0; double floatingPL = 0.0; for(int i = 0; i < PositionsTotal(); i++) { if(positionInfo.SelectByIndex(i)) { if(positionInfo.Symbol() == _Symbol && positionInfo.Magic() == InpMagicNumber) { floatingPL += positionInfo.Profit() + positionInfo.Swap(); if(positionInfo.PositionType() == POSITION_TYPE_BUY) buyCount++; if(positionInfo.PositionType() == POSITION_TYPE_SELL) sellCount++; } } } double bal = AccountInfoDouble(ACCOUNT_BALANCE); ObjectSetString(0, g_dashboardPrefix + "V_BALANCE", OBJPROP_TEXT, "$" + DoubleToString(bal, 2)); color floatColor = (floatingPL >= 0) ? C'72,187,120' : C'245,101,101'; string floatSign = (floatingPL >= 0) ? "+$" : "-$"; ObjectSetString(0, g_dashboardPrefix + "V_FLOAT", OBJPROP_TEXT, floatSign + DoubleToString(MathAbs(floatingPL), 2)); ObjectSetInteger(0, g_dashboardPrefix + "V_FLOAT", OBJPROP_COLOR, floatColor); color closedColor = (g_totalClosedProfit >= 0) ? C'212,175,55' : C'245,101,101'; ObjectSetString(0, g_dashboardPrefix + "V_CLOSED", OBJPROP_TEXT, "$" + DoubleToString(g_totalClosedProfit, 2)); ObjectSetInteger(0, g_dashboardPrefix + "V_CLOSED", OBJPROP_COLOR, closedColor); ObjectSetString(0, g_dashboardPrefix + "V_ORDERS", OBJPROP_TEXT, IntegerToString(buyCount) + " Buy / " + IntegerToString(sellCount) + " Sell"); ChartRedraw(); } void CreateDashboardLabel(string name, string text, int x, int y, color clr, int fontSize) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y); ObjectSetString(0, name, OBJPROP_TEXT, text); ObjectSetString(0, name, OBJPROP_FONT, "Segoe UI"); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, fontSize); ObjectSetInteger(0, name, OBJPROP_COLOR, clr); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_UPPER); } void DestroyDashboard() { ObjectsDeleteAll(0, g_dashboardPrefix); ChartRedraw(); }