mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-29 03:37:45 +00:00
c66b32a7bc
Perubahan ini mencakup: - Penataan ulang struktur direktori - Peningkatan dokumentasi - Penghapusan kode yang tidak terpakai - Peningkatan performa di beberapa fungsi Commit ini bertujuan untuk mempersiapkan basis kode untuk pengembangan lebih lanjut. Referensi: #1234 ---
24 lines
623 B
Python
24 lines
623 B
Python
import locale
|
|
import MetaTrader5 as mt5
|
|
|
|
locale.setlocale(locale.LC_NUMERIC, 'C')
|
|
|
|
def parse_decimal(val):
|
|
try:
|
|
return float(str(val).replace(',', '.'))
|
|
except Exception:
|
|
return 0.0
|
|
|
|
def initialize_mt5(account, password, server):
|
|
if not mt5.initialize():
|
|
print("Gagal inisialisasi MT5!", mt5.last_error())
|
|
return False
|
|
|
|
if not mt5.login(account, password=password, server=server):
|
|
print(f"Gagal login MT5 ke {server}, kode: {mt5.last_error()}")
|
|
mt5.shutdown()
|
|
return False
|
|
|
|
print(f"Login sukses ke akun MT5: {account} @ {server}")
|
|
return True
|