exporting/importing data in real time

Created at 10 Dec 2013, 17:20
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
BA

Balena

Joined 17.12.2012

exporting/importing data in real time
10 Dec 2013, 17:20


is there a way to export data real time...

ie can I send real time position, p/l, market data to an excel file or to an outside program?

if not is this in the works?

also would be good to be able to go both ways export data, modify, import, use is robots all in real time...

 

-Balena

 


@Balena
Replies

adaled
13 Dec 2013, 16:47

You can read and write to/from files using c#. Do you need help with reading and writing to files?


@adaled

Balena
17 Dec 2013, 16:59

RE:

Thank you... any help would be much appreciated!

How can I reverse this (from admin below) and read from a text file to bring values back into cAlgo?...

ie...

1. I use the below to pull price data into "txt file A"

2. I pull data from "txt file A" to use in another 3 party application

3. I create "txt file B" from the 3rd party application

4. I pull variables from "txt file B" back into cAlgo to use as logic

 

I have step #1 below...

I need help with step #4

 

thanks!

 

admin said:

You can use the following example if you want to output data to a text file:

 

using System;

using cAlgo.API;

using cAlgo.API.Indicators;

using cAlgo.Indicators;

using System.IO;

 

namespace cAlgo.Robots

{

    [Robot]

    public class WriteToFileExample : Robot

    {

        StreamWriter _fileWriter;

        double avspread = 0;

        double spreadnow = 0;

        double sum = 0;

        int ticker = 0;

        int once = 0;

        int counter =0;

         

        protected override void OnStart()

        {

            var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//getting location of user's Desktop folder 

            var filePath = Path.Combine(desktopFolder, "ServerTimeExample.txt");

             

            _fileWriter = File.AppendText(filePath);//creating file

             

            _fileWriter.AutoFlush = true;//file will be saved on each change

        }

         

        protected override void OnTick()

        {

            _fileWriter.WriteLine("Server Time: " + Server.Time);

        }

         

        protected override void OnStop()

        {

            _fileWriter.Close();

        }

    }

}

 

adaled said:

You can read and write to/from files using c#. Do you need help with reading and writing to files?

 


@Balena

Balena
17 Dec 2013, 17:59

very cool... thanks!


@Balena

joeatbayes
26 Dec 2014, 00:45

Is there still a need to Importing external signal files?

see:  /algos/cbots/show/588  and /algos/cbots/show/591  I have also written the portion which does the import and executes trades based on external signals.   If others will find it of value then let me know and I can post it as a new CBot.  It takes quite a bit of extra effort to package things for external consumption but if there is sufficient demand I will do so.  Thanks Joe E. 


@joeatbayes

ninosgr
08 Mar 2015, 13:55

RE: Is there still a need to Importing external signal files?

joeatbayes said:

see:  /algos/cbots/show/588  and /algos/cbots/show/591  I have also written the portion which does the import and executes trades based on external signals.   If others will find it of value then let me know and I can post it as a new CBot.  It takes quite a bit of extra effort to package things for external consumption but if there is sufficient demand I will do so.  Thanks Joe E. 

could you please share your code? thanks


@ninosgr

hukam
15 Jul 2015, 07:01

RE: RE: Is there still a need to Importing external signal files?

Live streaming, export, or synchronized quotes from Ctrader platform to Microsoft Excel

Hi, May i have download link of this finished algo. thanks

ninosgr said:

joeatbayes said:

see:  /algos/cbots/show/588  and /algos/cbots/show/591  I have also written the portion which does the import and executes trades based on external signals.   If others will find it of value then let me know and I can post it as a new CBot.  It takes quite a bit of extra effort to package things for external consumption but if there is sufficient demand I will do so.  Thanks Joe E. 

could you please share your code? thanks

 


@hukam

MerlinBrasil
19 Jul 2015, 05:11

Hi Joe,

I'd love to see your code, thanks!

 

Best,

Merlin


@MerlinBrasil

aimerdoux
10 Oct 2015, 05:54

RE: RE: Is there still a need to Importing external signal files?

ninosgr said:

joeatbayes said:

see:  /algos/cbots/show/588  and /algos/cbots/show/591  I have also written the portion which does the import and executes trades based on external signals.   If others will find it of value then let me know and I can post it as a new CBot.  It takes quite a bit of extra effort to package things for external consumption but if there is sufficient demand I will do so.  Thanks Joe E. 

could you please share your code? thanks

please show how to import data to cAlgo


@aimerdoux

Spotware
13 Oct 2015, 01:16

Dear Trader,

Please have a look at the following post: /forum/whats-new/1931


@Spotware