Excel with cAlgo.

Created at 19 Nov 2012, 22: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!
PC

PCWalker

Joined 19.11.2012

Excel with cAlgo.
19 Nov 2012, 22:20


Dear Sirs,

Markets are moving ahead.

Development is growing exponationally.

It would be great if you have an addin to work with Excel.

Thank you.


@PCWalker
Replies

admin
21 Nov 2012, 16:12

Thank you for the suggestion. We will consider adding an addin for Excel.

 


@admin

PCWalker
22 Nov 2012, 12:11

RE:
admin said:

Thank you for the suggestion. We will consider adding an addin for Excel.

 

It would be great if the add in will be simulaer to Mexcel Trader.
 
It would give cAlgo a head start to be one of the most popular Algoritmic Trading Platform in the market. :: UNLIMITED POSSIBILITIES::
 
Thank you.
 

@PCWalker

PCWalker
10 Apr 2013, 17:25

RE: RE:
PCWalker said:
admin said:

Thank you for the suggestion. We will consider adding an addin for Excel.

 

 

It would be great if the add in will be simulaer to Mexcel Trader.
 
It would give cAlgo a head start to be one of the most popular Algoritmic Trading Platform in the market. :: UNLIMITED POSSIBILITIES::
 
Thank you.
 

How is the development progressing? Any news on the Excel Addin?


@PCWalker

rkokerti
10 Apr 2013, 18:24

Hi PCWalker!

I wrote a code that export Backtest data to Excel.

You can find it here: /algos/robots/show/201

I know it is not an add-in, but maybe helps you.

 


@rkokerti

PCWalker
06 May 2013, 11:41

Excel Trading.

This kind of export is good, but it is not a system for placing orders from excel.

Which is what I need.

Thank you.


@PCWalker

cerana
02 Jun 2013, 14:31

RE:
rkokerti said:

Hi PCWalker!

I wrote a code that export Backtest data to Excel.

You can find it here: /algos/robots/show/201

I know it is not an add-in, but maybe helps you.

 

Bad!

Good?

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.IO;    //********** Export to file

namespace cAlgo.Robots
{
    [Robot]
    public class ExportToMSExcel : Robot
    {
//-----------------------------------------------------------------     
//     Add Parameters here (if any)
//-----------------------------------------------------------------  
//     Add variables here (if any)
    private Position _position;
    private Position _cposition;    //********** Export to file    
    StreamWriter _fileWriter;    //********** Export to file    
//-----------------------------------------------------------------    
    protected override void OnStart()
    {
//     Add your logic here  
    
//********** Export to file ********************          
    var name = GetType().ToString(); // returns cAlgo.Robot.ClassName
      var Classname = name.Substring(name.LastIndexOf('.') + 1);   //  returns ClassName    
    var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
    var filePath = Path.Combine(desktopFolder, Symbol.Code+Classname+".xls");         
    _fileWriter = File.AppendText(filePath);        
    _fileWriter.AutoFlush = true;                        
    _fileWriter.WriteLine("Symbol"+"    "+"Nr.OpenPos"+"    "+"ID"+"    "+"ShortDate"+"    "+"Date"+"    "+"DayName"+"    "+"Entry/ExitTime"+"    "+
                        "Volume"+"    "+"Type"+"    "+"Entry/ExitPrice"+"    "+"TakeProfit"+"    "+"StopLoss"+"    "+"Equity"+"    "+"Balance"+"    "+"Profit");                        
//****************************************     
    }        
//-----------------------------------------------------------------    
    protected override void OnBar() 
    {
//     Add your logic here (OnBar / OnTick)
    }   
//-----------------------------------------------------------------         
    protected override void OnPositionOpened(Position openedPosition)
        {      
        _position = openedPosition;
    
//     Add your logic here (if any)
    
        ExportOnOpened();      //********** Export to file
        }
//-----------------------------------------------------------------     
    protected override void OnPositionClosed(Position closedPosition)    //********** Export to file     
      {
      
//     Add your logic here (if any)      
      
      _cposition = closedPosition;
    string _Symbol = Symbol.Code.ToString();    
    string _ID = _cposition.Id.ToString();
    string _ShortDate = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month);
    string _Date = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month+"-"+Server.Time.Day);
    string _DayName = Server.Time.DayOfWeek.ToString();
    string _ExitTime = Convert.ToString(Server.Time);
    string _Equity = Account.Equity.ToString();
    string _Balance = Account.Balance.ToString();
    string _Positions = Account.Positions.Count.ToString();
    string _Profit = closedPosition.GrossProfit.ToString();
    string _ClosePrice = Symbol.Ask.ToString();

    _fileWriter.WriteLine(_Symbol+"    "+_Positions+"    "+_ID+"    "+_ShortDate+"    "+_Date+"    "+_DayName+"    "+_ExitTime+"            "+_ClosePrice+"            "+_Equity+"    "+_Balance+"    "+_Profit);
    }
//-----------------------------------------------------------------     
      protected override void OnStop()    //********** Export to file
      {
      
//     Add your logic here (if any)   

      _fileWriter.Close();    
      }
//-----------------------------------------------------------------     
    private void ExportOnOpened()    //********** Export to file
        {      
    string _Symbol = Symbol.Code.ToString();
    string _ID = _position.Id.ToString();
    string _ShortDate = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month);
    string _Date = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month+"-"+Server.Time.Day);
    string _DayName = Server.Time.DayOfWeek.ToString();
    string _EntryTime = _position.EntryTime.ToString();
    string _Volume = _position.Volume.ToString();
    string _Type = _position.TradeType.ToString();
    string _EntryPrice = _position.EntryPrice.ToString();
    
    string _Equity = Account.Equity.ToString();
    string _Balance = Account.Balance.ToString();
    string _Positions = Account.Positions.Count.ToString();    
    
    _fileWriter.WriteLine(_Symbol+"    "+_Positions+"    "+_ID+"    "+_ShortDate+"    "+_Date+"    "+_DayName+"    "+_EntryTime+"    "+_Volume+"    "+_Type+"    "+_EntryPrice+"        "+_Equity+"    "+_Balance);
    }
 } 
}  


@cerana

cerana
02 Jun 2013, 15:15

This is good.

 

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.IO;    //********** Export to file

namespace cAlgo.Robots
{
    [Robot]
    public class ExportToMSExcel : Robot
    {
//-----------------------------------------------------------------     
//     Add Parameters here (if any)
//-----------------------------------------------------------------  
//     Add variables here (if any)
    private Position _cposition;
     private Position _position;    //********** Export to file    
    StreamWriter _fileWriter;    //********** Export to file    
//-----------------------------------------------------------------    
    protected override void OnStart()
    {
//     Add your logic here  
    
//********** Export to file ********************          
    var name = GetType().ToString(); // returns cAlgo.Robot.ClassName
      var Classname = name.Substring(name.LastIndexOf('.') + 1);   //  returns ClassName    
    var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
    var filePath = Path.Combine(desktopFolder, Symbol.Code+Classname+".xls");         
    _fileWriter = File.AppendText(filePath);        
    _fileWriter.AutoFlush = true;                        
    _fileWriter.WriteLine("Symbol"+"    "+"Nr.OpenPos"+"    "+"ID"+"    "+"ShortDate"+"    "+"Date"+"    "+"DayName"+"    "+"Entry/ExitTime"+"    "+
                        "Volume"+"    "+"Type"+"    "+"Entry/ExitPrice"+"    "+"TakeProfit"+"    "+"StopLoss"+"    "+"Equity"+"    "+"Balance"+"    "+"Profit");                        
//****************************************     
    }        
//-----------------------------------------------------------------    
    protected override void OnBar() 
    {
//     Add your logic here (OnBar / OnTick)
    }   
//-----------------------------------------------------------------         
    protected override void OnPositionOpened(Position openedPosition)
        {      
        _position = openedPosition;
    
//     Add your logic here (if any)
    
        ExportOnOpened();      //********** Export to file
        }
//-----------------------------------------------------------------     
    protected override void OnPositionClosed(Position closedPosition)    //********** Export to file     
      {
      
//     Add your logic here (if any)      
      
      _cposition = closedPosition;
    string _Symbol = Symbol.Code.ToString();    
    string _ID = _cposition.Id.ToString();
    string _ShortDate = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month);
    string _Date = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month+"-"+Server.Time.Day);
    string _DayName = Server.Time.DayOfWeek.ToString();
    string _ExitTime = Convert.ToString(Server.Time);
    string _Equity = Account.Equity.ToString();
    string _Balance = Account.Balance.ToString();
    string _Positions = Account.Positions.Count.ToString();
    string _Profit = closedPosition.GrossProfit.ToString();
    string _ClosePrice = Symbol.Ask.ToString();

    _fileWriter.WriteLine(_Symbol+"    "+_Positions+"    "+_ID+"    "+_ShortDate+"    "+_Date+"    "+_DayName+"    "+_ExitTime+"            "+_ClosePrice+"            "+_Equity+"    "+_Balance+"    "+_Profit);
    }
//-----------------------------------------------------------------     
      protected override void OnStop()    //********** Export to file
      {
      
//     Add your logic here (if any)   

      _fileWriter.Close();    
      }
//-----------------------------------------------------------------     
    private void ExportOnOpened()    //********** Export to file
        {      
    string _Symbol = Symbol.Code.ToString();
    string _ID = _position.Id.ToString();
    string _ShortDate = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month);
    string _Date = Convert.ToString(Server.Time.Year+"-"+Server.Time.Month+"-"+Server.Time.Day);
    string _DayName = Server.Time.DayOfWeek.ToString();
    string _EntryTime = _position.EntryTime.ToString();
    string _Volume = _position.Volume.ToString();
    string _Type = _position.TradeType.ToString();
    string _EntryPrice = _position.EntryPrice.ToString();
    string _TakeProfit = _position.TakeProfit.ToString();
    string _StopLoss = _position.StopLoss.ToString();
    string _Equity = Account.Equity.ToString();
    string _Balance = Account.Balance.ToString();
    string _Positions = Account.Positions.Count.ToString();    
    
    _fileWriter.WriteLine(_Symbol+"    "+_Positions+"    "+_ID+"    "+_ShortDate+"    "+_Date+"    "+_DayName+"    "+_EntryTime+"    "+_Volume+"    "+_Type+"    "+_EntryPrice+"    "+_TakeProfit+"    "+_StopLoss+"    "+_Equity+"    "+_Balance);
    }
 } 
}  


@cerana

PCWalker
02 Jul 2013, 17:07

RE:

Thank you very much for your contribution, May I know what do you mean by "backtest data into MS Excel file"?

Does it send the orders already placed to Excel file, so one can analyze the trading?

Or it receives data in real time into excel including exchange data?

Thank you.


@PCWalker

PCWalker
02 Jul 2013, 17:09

RE: Excel Addin.
admin said:

Thank you for the suggestion. We will consider adding an addin for Excel.

 

 

May I know, how are you progressing with the addin for excel?

Thank you for your prompt reply.


@PCWalker

cAlgo_Fanatic
02 Jul 2013, 17:43

Hello,

The backtest history will have an option to export to excel in the next release, next week. 


@cAlgo_Fanatic

PCWalker
25 Jul 2013, 16:11

RE:
cAlgo_Fanatic said:

Hello,

The backtest history will have an option to export to excel in the next release, next week. 

Export to Excel, Was that hard to develop?

Dear Sirs,

I am talking about an perfect addin that will except orders from excel. and send data to excel in real time.

Hope this will inspire you to work harder and faster to improve the ability of your system.

There is high competition in the market. 

Thank you.


@PCWalker

cAlgo_Fanatic
31 Jul 2013, 16:36

The option to export the backtesting resutls as well as live history data to excel has been released.


@cAlgo_Fanatic

PCWalker
12 Aug 2013, 14:32

RE:

As you have stated before, Visual studio Integration will be the most attractive feature of all.

Thank you.

The option to export the backtesting resutls as well as live history data to excel has been released.
 

 


@PCWalker