Session & CustomInstrument

Questions about MultiCharts .NET and user contributed studies.
lordongi
Posts: 6
Joined: 18 Dec 2017

Session & CustomInstrument

Postby lordongi » 18 Dec 2017

Hi,

I want to implement an indicator that loads a custom ASCII symbol for further calculations. It seems that the CustomInstrument inherits the session of the main chart symbol. But I'd like to apply another session to my CustomInstrument (a different session as it used by the main chart). The session set in the QuoteManager (in this case for "OVX.XO.M1") seems not being considered.

Do have an idea how to achieve this? Here is the code:

Code: Select all

public class Test_CustomInstrument : IndicatorObject
   {
      public Test_CustomInstrument(object _ctx):base(_ctx){}
      private IPlotObject plot1;

       CustomInstrument m_MyCustomInstrument;

      protected override void Create()
      {
         plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));
      }
      
      protected override void StartCalc()
      {

            MTPA_MCSymbolInfo2[] symb = SymbolStorage.GetSymbols("ASCII Mapping", "OVX.XO.M1", ESymbolCategory.Index);
            if (symb.Length > 0)
         {
                MTPA_MCSymbolInfo2 mySymbol = symb[0];
                Output.WriteLine("symbol name = " + mySymbol.SymbolName);
                Output.WriteLine("main symbol session = " + Bars.Request.SessionName);
                m_MyCustomInstrument = new PowerLanguage.CustomInstrument(Bars, "ASCII Mapping", mySymbol, Bars.Request.Resolution, false);
                Output.WriteLine("custom symbol session = " + m_MyCustomInstrument.Request.SessionName);
            }
        }
      
      protected override void CalcBar()
      {
            plot1.Set(m_MyCustomInstrument.CloseValue);
       }
      
      protected override void Dispose( bool _b)
      {
         m_MyCustomInstrument.Dispose();   
      }
   }



Regards

User avatar
Anna MultiCharts
Posts: 147
Joined: 14 Jul 2017
Has thanked: 4 times
Been thanked: 27 times

Re: Session & CustomInstrument

Postby Anna MultiCharts » 21 Dec 2017

Hello, lordongi!

CustomInstrument was intended to be used for the basic (main) data series. It cannot get sessions for other instruments. For that purpose you can use DataLoader:
https://www.multicharts.com/trading-sof ... DataLoader

If you’d like to change the functionality of CustomInstrument then you can leave a feature request here:
http://www.multicharts.com/pm/

lordongi
Posts: 6
Joined: 18 Dec 2017

Re: Session & CustomInstrument

Postby lordongi » 05 Jan 2018

Ok, I solved it using BarsOfData.
Thank you.


Return to “MultiCharts .NET”