Connecting TradingView Email Signals to MT4

Connecting TradingView Email Signals to MT4

Manage alerts

Loading saved threads...

beaggio · External communityPost link
External question — Stack Overflow Stack Exchange Author: beaggio Original post: https://stackoverflow.com/questions/77391624 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I don't have much knowledge about coding, but I tried experimenting with some research. I want to enable TradingView Email signals on MT4, but although the emails are being read, they are not being executed on MT4. I would be very happy if you could help me with this. import imaplib import email import zmq import random import datetime, time from email.header import decode_header volume = '0.1' user = '' pwd = '' c = zmq.Context() print("Connecting to the mt4 server...") s = c.socket(zmq.REQ) s.connect("tcp://127.0.0.1:5555") # Bu bağlantı noktası belki değiştirilmeli r = c.socket(zmq.PULL) r.connect("tcp://127.0.0.1:5556") # Diğer bir port numarası def generate_nonce(length=8): """Generate pseudorandom number.""" return ''.join([str(random.randint(0, 9)) for i in range(length)]) def trade(signal,volume,pair): try: trade = 'TRADE|OPEN|' + signal + '|' + pair + '|0|0|0|IcarusBot Trade|' + generate_nonce() + '|' + volume s.send_string(trade, encoding='utf-8') print("Waiting for metatrader to respond...") m = s.recv() print("Reply from server ", m) except Exception as e: print(e) print("Listening to email server...") def readmail(volume): # print("Sleeping 3 Seconds") time.sleep(0.1) m = imaplib.IMAP4_SSL("imap.yandex.com") m.login(user, pwd) m.select('INBOX') today = datetime.date.today().strftime("%d-%b-%Y") resp, items = m.search(None, f'NOT SEEN FROM tradingview SENTON "{today}"') items = items[0].split() for emailid in items: resp, data = m.fetch(emailid, "(RFC822)") email_body = data[0][1] mail = email.message_from_bytes(email_body) # mail değişkenini tanımlama try: subject = mail['Subject'] if subject is not None: print(subject) # Kontrol amaçlı eklendi subject_parts = subject.split() pair = None for part in subject_parts: if part == "XAUUSD": pair = part if part == "Buy": m.store(emailid, '+FLAGS', '\\Seen') print(subject + ' \x1b[6;30;42m' + 'Buy' + '\x1b[0m' + ' Triggered on ' + pair) trade('0', volume, pair) elif part == "Sell": m.store(emailid, '+FLAGS', '\\Seen') print(subject + ' \x1b[6;30;41m' + 'Sell' + '\x1b[0m' + ' Triggered on ' + pair) trade("1", volume, pair) else: print("Subject is None.") except Exception as e: print(e) while True: readmail(volume) The code I want to run is this. I am running the code, it is fetching the subject of the emails, but it is not executing on MT4.
Quote
Report
Stackoverflower · External communityPost link
External answer — Stack Overflow Stack Exchange Author: Stackoverflower Original post: https://stackoverflow.com/a/79077725 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. You can use Trading Router to connect Tradingview signals to MT4
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: Stackoverflower Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/79077725 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. You can use Trading Router to connect Tradingview signals to MT4

Cancel quote

Checking account access…