Profile Picture

UserSeries in MySystem Class

Posted By johan 2 Years Ago
Message
Posted Saturday June 27 2015
I want to use a User Series in MySystem Class.  It does not initialise.  Should it be registered in the MySystem Class?  If so, how should it be constructed?  I currently have this in Startup():

DailyEquityTotal = new UserSeries();
SystemData.IndicatorManager.Register(DailyEquityTotal,null,"DQT");


but it does not seem that null is working.  What do I add for Symbol, as it is not linked to a symbol.

Thanks

Johan
Posted Monday June 29 2015
Yes, you need to pass it a Symbol.  You might just use Symbols.First() to pass it a somewhat arbitrary symbol.

On the other hand, if the series isn't associated with a symbol, is there any reason you need to use a UserSeries?  You could just use a List<double> or RList<double>.

Thanks,
Daniel
Posted Monday June 29 2015
Thanks Daniel.  I want to have a chart for this (it is the total equity of a CFD portfolio).  As I understand, you can not have a chart for a RList.
Posted Wednesday July 01 2015
Hi Johan,

Charts also need to be associated with a symbol.  So you could pick a symbol to put the chart on, or put it on all symbols.

Another option would be to write your own system results plugin.  That will let you add a tab to the system results where you control the UI, so you could draw the chart there yourself.

Thanks,
Daniel
Posted Wednesday July 01 2015
Thanks Daniel.  My C# is at this stage not advanced enough for a Results Plugin.  Are there any plugins I can have a look at to learn a bit?
Posted Thursday July 02 2015
Daniel
I have posted another question on the System Results plugin, but am struggling to display the UserSeries as a chart.  After simulation is run, the specific symbol is not on the Trade List - where can I see the chart for the UserSeries?  Here is extract from code.

public class MySystem : MySystemBase

{

    public UserSeries portfolioEquity;

   

  

    public override void Startup()

    {

        //Perform initialization or set system wide options here

       

 

        portfolioEquity = new UserSeries();

        SystemData.IndicatorManager.Register(portfolioEquity,Symbols.First(), "DEQ");

       portfolioEquity.ChartSettings.ChartPaneName = "EquityCurve";

        portfolioEquity.ChartSettings.Color = Color.Blue;

       portfolioEquity.ChartSettings.DisplayName = "Equity Curve";

    }

    public override void NewBar()

    {

       

       

  

        base.NewBar();

        foreach (MySymbolScript systemPosition in SymbolScripts)

        {

            totalEquity +=systemPosition.equity;

            totalSystemInterest +=systemPosition.todayInterest;

        }

 

        tradingDays++;

        portfolioEquity.SetValue(0, totalEquity);



Posted Monday July 06 2015
The source code for the system results plugins that ship with RightEdge is included for reference in the samples that are installed with RightEdge, under RightEdgePlugins\SystemResults.  So you can look at that code to see how the current ones are implemented.

You can open up a chart for any symbol in the simulation by double clicking it in the "Symbol Results" tab of the system results.  If the tab is not visible, you can show it in the View \ System Results menu, and you can enable it by default for future simulations in the "System Results" tab of the RightEdge options.

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems