Writing to PowerLanguage Editor output log - how?  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
User avatar
JoshM
Posts: 2074
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1523 times
Been thanked: 1479 times
Contact:

Writing to PowerLanguage Editor output log - how?

Postby JoshM » 01 Aug 2012

I'm a little bit stuck with practising MC .NET since I can't output my data to the output log, which makes it hard to verify what I'm doing. Can someone give me a tip? :)

I'm getting stuck with implementing the methods of the IOutput interface. According to MSDN, a class that implements an interface, needs to implement all methods from that interface. However, I can't seem to access the PowerLanguage Editor output log to actually implement the interface. So far, I only have empty methods:

Code: Select all

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;

namespace PowerLanguage.Indicator
{
    public class MyTestIndicator : IndicatorObject
    {
        public MyTestIndicator(object _ctx):base(_ctx){}
       
        protected override void Create() { }

      protected override void StartCalc() { }

      protected override void CalcBar()
        {
            InterfaceImplementer myInterface = new InterfaceImplementer();
            myInterface.WriteLine("{0} {1}", new[] { "Hello", "world!" });
      }
   }

    public class InterfaceImplementer : IOutput
    {
        public void Clear()
        {
            // .. ?
        }

        public void Write(string format, params object[] args)
        {
            // .. ?
        }

        public void WriteLine(string format, params object[] args)
        {
            // .. ?
        }
    }
}

rainworm
Posts: 11
Joined: 19 Apr 2011
Has thanked: 3 times
Been thanked: 5 times

Re: Writing to PowerLanguage Editor output log - how?  [SOLVED]

Postby rainworm » 01 Aug 2012

Just write:

Code: Select all

...
protected override void CalcBar()
{
 ...
 Output.WriteLine(Convert.ToString(StrategyInfo.MarketPosition));
 ...
}
...
These users thanked the author rainworm for the post (total 3):
JoshMStan Bokovadmin

User avatar
JoshM
Posts: 2074
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1523 times
Been thanked: 1479 times
Contact:

Re: Writing to PowerLanguage Editor output log - how?

Postby JoshM » 01 Aug 2012

Thanks Rainworm!


Return to “MultiCharts .NET”