Category Other  Published on 02/07/2014

MT to cTrader Trade Copier

Description

MT4 to cTrader Trade Copier is designed to copy MT4 trades from any demo or live MT4 account to any demo or live cTrader account. 
MT4 Investor Password is enough to start copying trades right now.

Website: http://mt2ct.com/


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using cAlgo.API;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class TradeCopierReceiver : Robot
    {
        private const int TimerIntervalInMs = 100;
        private const string CopierTextObjectName = "info";
        private readonly TimeSpan _defaultTimerInterval = TimeSpan.FromMilliseconds(TimerIntervalInMs);
        private CopierFileService _copierFileService;
        private ExecutionService _executionService;

        private DateTime _lastWriteTimeCache = DateTime.MinValue;
        private TimeSpan _maxInterval;

        [Parameter("Symbols", DefaultValue = "")]
        public string SymbolsFilter { get; set; }

        [Parameter("Copy Protection (SL, TP)", DefaultValue = true)]
        public bool CopyProtectionEnabled { get; set; }

        [Parameter("Copy Long (Buy) positions", DefaultValue = true)]
        public bool CopyBuy { get; set; }

        [Parameter("Copy Short (Sell) positions", DefaultValue = true)]
        public bool CopySell { get; set; }

        [Parameter("CopierID")]
        public int CopierID { get; set; }

        protected override void OnStart()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            _copierFileService = new CopierFileService(this);
            _executionService = new ExecutionService(this);

            if (_copierFileService.CanProcessFile)
            {
                Timer.Start(_defaultTimerInterval);
                ChartObjects.DrawText(CopierTextObjectName, "Signal Receiver is running...", StaticPosition.TopRight, Colors.Yellow);
            }
            else
                Stop();
        }

        protected override void OnTimer()
        {
            _copierFileService.UpdateState();

            IEnumerable<TraderCopierArguments> args;
            if (!CanProcessArguments(out args))
                return;

            if (_executionService.Execute(args))
                _lastWriteTimeCache = _copierFileService.LastWriteTime;

            SetProcessingFileResult();
        }

        private bool CanProcessArguments(out IEnumerable<TraderCopierArguments> args)
        {
            args = null;

            if (!_copierFileService.CanProcessFile)
                return false;

            if (_copierFileService.LastWriteTime == _lastWriteTimeCache)
                return false;

            try
            {
                args = File.ReadAllLines(_copierFileService.FilePath).Select(TraderCopierArguments.Parse).ToArray();
            } catch (IOException ex)
            {
                Print("Read information failed: " + ex.Message);
                SetProcessingFileResult();
                return false;
            } catch (Exception exception)
            {
                Print("Failed to read file: " + exception.Message);
                Stop();
                return false;
            }
            return true;
        }

        private void SetProcessingFileResult()
        {
            if (_executionService.ExecutedOperationsCount > 0)
                DoubleTimerInterval();
            else
                ResetTimer();
        }

        private void ResetTimer()
        {
            Timer.Start(_defaultTimerInterval);
        }

        private void DoubleTimerInterval()
        {
            var newInterval = TimeSpan.FromMilliseconds(Timer.Interval.TotalMilliseconds * 2);
            _maxInterval = TimeSpan.FromMinutes(1);
            if (newInterval > _maxInterval)
                newInterval = _maxInterval;
            Timer.Start(newInterval);
        }

        protected override void OnStop()
        {
            Timer.Stop();

            ChartObjects.RemoveObject(CopierTextObjectName);
        }
    }
}


MT
mt2ct

Joined on 02.07.2014

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: TradeCopierReceiver.algo
  • Rating: 0
  • Installs: 5417
Comments
Log in to add a comment.
H.
h.momeni60 · 1 month ago

 If you are looking for a way to copy trades from MT4 to crader, contact me here or telegram t.me/HabibMomeni

ctrader.guru's avatar
ctrader.guru · 2 years ago

If you want to copy trades to and from MT4 / MT5 / cTrader you have to use Bifrost, which is free and will become open source next year if there are an adequate number of sponsors:

Installation is very simple, only assistance is given to sponsors to keep the project free.

RT
RTrader007 · 2 years ago

@armagedon did you solve your issue (I have the same ;-). Thx for sharing. 

MR
mrtuanvn · 3 years ago

Hi all,

The links seem to be gone. Please kindly share on Google Drive or similar.  Many thanks.

BL
BlackhatForex · 3 years ago

Hi,
I downloaded the Cbot & installed, but..

MT4 Trade Sender ex4 is no longer available, for connecting the MT4 Terminal
- Does someone have this?

Also,
in the Cbot code, i do not see where i can add the MT4 acocunt Details?

(I am trying to Send MT4 trades to CTrader)

Thanks

ES
esarku · 4 years ago
  • any idea how the external path to MT4 works..cause I m getting error that the mt4 path does not exist?
  • Thanks
ChasBrownTH's avatar
ChasBrownTH · 7 years ago

I added the .ex4 as a download.

http://angloam.net/MT4-cAlgo-TradeCopier-OLD-files/TradeCopierProvider.ex4

ChasBrownTH's avatar
ChasBrownTH · 7 years ago

That domain name is now for sale, so I guess the previous operator gave up?

I have a copy of the MT4 Trade Sender source file, so I put it online, HERE:

http://angloam.net/MT4-cAlgo-TradeCopier-OLD-files/TradeCopierProvider.mq4

Use that source code to build an .ex4, then run it. Change the ID in both MT4 and cAlgo versions, the IT WORKS! At least it works for me, 99.9% of the time.

However lately I had a few problems, some of my VPS instances started using different default MT4 Data Directories/Folders, either in 'Program Files(x86)' OR in .AppData/Roaming/etc .. VERY CONFUSING!

I must stress that the .mq4 FILE I am making available is NOT my work, nor am I 'supporting it'. But if anybody has rael problems getting it to work then I am willing to try to help.

NO
nolenar · 7 years ago

Good morning!

The page won't load  http://mt2ct.com/ I get 'your connection has timed out' message, and then the 504 error. (I have refreshed multiple times, and tried different connections.) Can you check it, please?

mDull's avatar
mDull · 7 years ago

What I am doing to avoid the problem of partial closures, is open microlots (1k). Then I can close the positions I want, without changing the commission costs.

Regards

@mDull618

AB
ABC1 · 7 years ago

nHen, simply use www.cmirror.com from Spotware to copy trades from one cTrader account to another. Link all accounts via your cTID and then login to cMirror and enble copying. You may also copy the trades of succesful traders for a fee -copy mine called AAA+ -:)  Although cMirror is efficient in copying trades, it has some bugs with the website - total for all open trades does not add up properly, all linked acounts do not show the signal provide it is mirroring, etc, etc. A new version of cMirror is under construction. 

AB
ABC1 · 7 years ago

The main issue I have with this cBot is that partial trade closure in MT4 causes closure of the entire trade in CT. CT then opens another trade at the current market price for the remaining volume. It is a serious issue as one could lose much money. Do any of the programmers know of a fix?

KI
kitcadservices · 7 years ago

Hi, Thanks This was super easy to install and worked perfectly. Can you let me know when you will be adding a lot multiplyer or similar so it will open trades more suitable to account size. Cheers

DJ

Say I wanted to place a trade with MT4 based on price movement in cTrader..

Can this be done?

NH
nhen · 7 years ago

Anyone ever find a solutions for copying trades between two cTrader accounts?

CO
conny.rosenberg@gmail.com · 7 years ago

explict file path wath this meen?

BU
bull375 · 7 years ago

Can we have one that copies from ctrader to mt4? ctrader is superb for trading but my broker has only metatrader 4.

ctrader charting platform is the best. One can easily trade H8 or H12 using D2 and D3 as bias charts.

OL
olikern26 · 8 years ago

Can somebody tell me how the Trade Copier works? How can cAlgo receive signals from indicators on MT4? 

LK
lkbaghel · 8 years ago

i want copy trader from Ctrder to MT4

AR
armagedon · 8 years ago

How to make it work in 1 chart at mt4 where other EA is running? I use EA, so need it to be copied into ctrader

TO
topgun · 8 years ago

is there a way to say have the MT4 trade 1 lot and the Ctrader to trade 0.5 or 2 lots ?

AH
ahas · 8 years ago

anyone still using this cbot? i installed it on mt4 and ctrader but it's not working on ctrader when i press play button it does nothing means not activating. any solution?

GO
Gorydan · 9 years ago

@mindbreaker As RedRhinoFX said, I would like a version with the socket connection always opened because I use a scalper EA on MT4 that works on price impulsion and closes the positions very fast.

A low latency is very important between MT4 and CTrader. The door between them must stay opened to not have to open it every trade.

Thanks

ME
megamemo · 9 years ago

hi and the ea where do i findit?' im count of loss cut somebody explainme 

mindbreaker's avatar
mindbreaker · 9 years ago

@RedRhinoFX - it is simple example (but if provider set order only one in a day/week/month for what keep socket connection open all the time) or for what send the same data to the server  every tick :)

DA
Dave_gen · 9 years ago

@[RedRhinoFX] i am interested in Ctrader to cTrader Trade copier , do you happen to have a solution now?

Thanks

 

SwapBridgeCapital's avatar
SwapBridgeCapital · 9 years ago

@MindBreaker - https://github.com/breakermind/cAlgoCopier/blob/master/cAlgoSignalProvider.algo - Why not keep the socket connection open? Such as provider <-> server <-> client 

 

that way, the instant a trade opens it will be relayed to the client
because a socket connect is open between the two

ST
Stearns · 9 years ago

I agree with kamol.

I did the install, but only found the cAlgo Receiver files, not the MQL Sender files.  

Where can I get that?

Thanks,

Stearno

KA
kamol · 9 years ago

Hi

How does it know the path where I installed MT4.

I installed the EA but could not find any "TradeCopierProvider" file.

mindbreaker's avatar
mindbreaker · 9 years ago

Hi [RedRhinoFX] I have got a solution, see Your messages.

SwapBridgeCapital's avatar
SwapBridgeCapital · 9 years ago

Can this be used to copy cTrader to cTrader using the same method? 

Please view my job listing here - http://ctrader.com/jobs/105

MT
mt2ct · 9 years ago

is possible copy to ctrade at mt4 ?

and copy pending orders

and set trail protection.

thanks.

No, it is not possible to copy pending orders.

Trail protection will be copied if you set trailing stop in MT.

aisaac's avatar
aisaac · 9 years ago

is possible copy to ctrade at mt4 ?

and copy pending orders

and set trail protection.

thanks.

MT
mt2ct · 9 years ago
AS
ashgupta · 9 years ago

Still the same issue mate. Can't download as link is down. 

 

The web page at https://onedrive.live.com/download?resid=8354967F438497B7!107 might be temporarily down or it may have moved permanently to a new web address.

MT
mt2ct · 9 years ago

Download is working. Please try it one more time.

AS
ashgupta · 9 years ago

Download is not working on the Website: http://mt2ct.com/ . Can you please fix it ? I would like to give this copier a go and will like to test it.