NexusFi: Find Your Edge


Home Menu

 





MT4 to ToS bridge


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,551 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

MT4 to ToS bridge

  #1 (permalink)
jmexpat
Nashville TN/USA
 
Posts: 5 since Mar 2018
Thanks Given: 0
Thanks Received: 0

Hello everyone,

I am looking for an "MT4 to ThinkOrSwim bridge" either as a product or a way to code it, but especially as a coding project. Perhaps using the ToS API.
a program in MT4 will generate the signals and the trades will be placed in ToS
Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quant vue
Trading Reviews and Vendors
What broker to use for trading palladium futures
Commodities
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
 
  #2 (permalink)
 lamden 
San Francisco
 
Experience: Intermediate
Platform: TradeStation
Trading: ES
Posts: 7 since Nov 2018

It depends on your level of programming skill. What I would do (and if this is too complex, I could try to come up with something simpler) is use the MT4 Webrequest to send a message to a Python Flask application running locally on your machine which parses this message and sends the appropriate trade signal to your ToS account.

Check out this API reference:
docs.mql4.com/common/webrequest
flask.pocoo.org

So instead of having a buy or sell action in MQL, you would send this message with data that can be parsed by a simple Python application.

MT4 side:
 
Code
res=WebRequest("POST","127.0.0.1/buy",NULL,0,NULL,NULL,NULL);
Python side:
 
Code
@app.route("/buy")
def buy():
    try:
        # add your ToS API logic here
        return "Success!"
    except:
        return "Failure!"

Reply With Quote
  #3 (permalink)
jmexpat
Nashville TN/USA
 
Posts: 5 since Mar 2018
Thanks Given: 0
Thanks Received: 0


Hi lamden

Thanks for your reply

I know next to nothing except for some basic exposure with coding in php script in a apache / tomcat environment.

Would it not be possible to call the ToS web service directly from the mql code ?

Reply With Quote
  #4 (permalink)
 lamden 
San Francisco
 
Experience: Intermediate
Platform: TradeStation
Trading: ES
Posts: 7 since Nov 2018


jmexpat View Post
Hi lamden

Thanks for your reply

I know next to nothing except for some basic exposure with coding in php script in a apache / tomcat environment.

Would it not be possible to call the ToS web service directly from the mql code ?

You can. I guess I'm just partial to Python so I'd write a middle layer so I could get it into a language I know :P

You should be able just to call the endpoint via MQL but you will have to fiddle with their WebRequest API which is not as straightforward as other languages.

That being said, if you don't know any other languages, just use MQL and you'll be fine.

Reply With Quote
  #5 (permalink)
John Nachos
New york
 
Posts: 2 since Nov 2018
Thanks Given: 0
Thanks Received: 0


lamden View Post
You can. I guess I'm just partial to Python so I'd write a middle layer so I could get it into a language I know :P

You should be able just to call the endpoint via MQL but you will have to fiddle with their WebRequest API which is not as straightforward as other languages.

That being said, if you don't know any other languages, just use MQL and you'll be fine.


I'm trying something similar, but for a reason I can't even connect my TOS account using MT5 or MT4.

I was wondering if you had any success and could share some thoughts on how to do it?

Thank you!

Reply With Quote




Last Updated on November 27, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts