SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Jun 23, 2021 6:25 pm

All times are UTC + 3 hours

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Recover PnLSeries
PostPosted: Wed Feb 26, 2014 5:47 pm 

Joined: Sat Sep 08, 2007 11:52 pm
Posts: 1

I would like to retrieve the PnLSeries that is shown in the Performance Tab.

I tried this piece of code and it dit not worked. I am using the Simple Moving Average CrossOver sample.

Step 1: Add .Net Libs

using System.IO;
using System.Collections;
using System.Collections.Generic;

Step 2: Add List of Dates

List<DateTime> ldates;

public override void OnStrategyStart()
ldates = new List<DateTime>();

public override void OnBar(Bar bar)

public override void OnStrategyStop()
string file_name = "equity_series_" + Instrument.Symbol+".txt";


using(StreamWriter sw = new StreamWriter(@"C:\SmartQuant_Testing\"+file_name))
for(int i=0;i<ldates.Count;i++)
DateTime dt = ldates[i];
int iid = this.Performance.EquitySeries.GetIndex(dt);
string eqt_name = this.Name;
double eqt_value = this.Performance.PnLSeries[iid];
string eqt_symbol = this.Instrument.Symbol;
string eqt_date = dt.ToString("yyyy-MM-dd HH:mm:ss");
sw.WriteLine("{0};{1};{2};{3}", eqt_name, eqt_symbol, eqt_date, eqt_value);



Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 3 hours

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group