Hi,
C2 provides various measures of Risk, such as Risk of Ruin (Monte-Carlo). However, these are not helpful when measuring potential risk on a futures strategy, particularly if the strategy is new or if the strategy developer has changed his trading strategy recently.
For futures systems, it is very important for subscribers to understand Notional Value and Leverage. As this is not readily available on the grid, we developed C2Explorer code for our in-house use and also decided to put it out in public domain. We believe this will help subscribers identify strategies employing Martingale techniques, as discussed in this previous post.
Disclaimer before we go any further with this : We are the owners of TickPrime SP500.
Here are the results of this code:
Here is the C2Explorer code for your perusal:
// Select Systems we want in charts Int64[] systemsIds = { 90325773, 46106678, 97642708, 95943912, 92728998 , 89240089, 94739988, 96506348, 93171889, 93192881 , 94661371, 97468745, 83833839, 75421760, 94514120 };
// Set starting date (YYYY,MM,DD) var startingDate = new DateTime(2015,01,01);
// Create chart objects ITimeSeriesChart notionalValueChart = new TimeSeriesChart(); notionalValueChart.Name = "Notional Value"; ITimeSeriesChart leverageMultipleChart = new TimeSeriesChart(); leverageMultipleChart.Name = "Leverage Multiple";
// Variables Random random = new Random(); decimal netOpenPos = 0; List<ITimeSeriesPoint> nvData = new List<ITimeSeriesPoint>(); List<ITimeSeriesPoint> lmData = new List<ITimeSeriesPoint>(); List<ITimeSeriesPoint> npData = new List<ITimeSeriesPoint>();
// Add Systems to charts foreach (var id in systemsIds) { // Initialize Charts data for System IChartTimeSeries nvChSeries = new ChartTimeSeries(); nvChSeries.Type = ChartTypes.Line; nvChSeries.Name = (from sys in C2SYSTEMS where sys.SystemId == id select sys.SystemName).First(); nvChSeries.Color = Color.FromArgb(random.Next(255), random.Next(255), random.Next(255));
IChartTimeSeries lmChSeries = new ChartTimeSeries(); lmChSeries.Type = ChartTypes.Line; lmChSeries.Name = nvChSeries.Name; lmChSeries.Color = nvChSeries.Color;
// Reset Variables for System netOpenPos = 0; nvData = new List<ITimeSeriesPoint>(); lmData = new List<ITimeSeriesPoint>();
// Identify Positions and NotionalValue foreach (var sigQ in (from sig in C2SIGNALS where (sig.SystemId == id && sig.TradedWhen > startingDate) orderby sig.Id select new {d=sig.TradedWhen,q=sig.Quant,a=sig.Action,p=sig.TradePrice,ptV=sig.PtValue} )) { if(sigQ.a == "BTO" || sigQ.a == "BTC"){ netOpenPos += sigQ.q; }else if(sigQ.a == "STO" || sigQ.a == "STC"){ netOpenPos -= sigQ.q; } nvData.Add( new TimeSeriesPoint() { DateTime = sigQ.d, Value = (double)(sigQ.ptV*sigQ.p*netOpenPos) }); }
// Identify Leverage foreach (var nv in nvData) { var eqPtVal = (from eqdata in C2EQUITY where (eqdata.SystemId == id && eqdata.DateTime > nv.DateTime) orderby eqdata.DateTime ascending select eqdata.Value).First(); lmData.Add(new TimeSeriesPoint() { DateTime = nv.DateTime, Value = Math.Abs(nv.Value/(double)eqPtVal) }); }
// Configure Charts nvChSeries.Data = nvData; notionalValueChart.Add(nvChSeries); lmChSeries.Data = lmData; leverageMultipleChart.Add(lmChSeries); }
// Plot the Charts CHART = leverageMultipleChart; HR(); CHART = notionalValueChart;
Finally, it will be nice if you can share any modifications to this code, which you believe will benefit others.
Regards,
ACA