Ok thx. I made this User Provider:
Code:
using System;
using System.ComponentModel;
using System.Collections.Generic;
using OpenQuant.API;
using System.Threading;
using System.Windows.Forms;
namespace EProv.dll
{
class EProv : OpenQuant.API.Plugins.UserProvider
{
public EProv()
{
base.name = "EPROV";
base.description = "testing";
base.id = 100;
base.url = "http://www.hello.com";
}
protected override void Subscribe(Instrument instrument)
{
base.Subscribe(instrument);
}
protected override void Connect()
{
base.isConnected = true;
Instrument i = new Instrument(InstrumentType.Stock, "EC");
Subscribe(i);
double p = 0;
while (true)
{
Thread.Sleep(1000);
MessageBox.Show("Bing!");
recieveprice(i, p);
p++;
}
}
public void recieveprice(Instrument i, double p)
{
base.EmitNewTrade(i, Clock.Now, p, 1);
}
protected override void Disconnect()
{
base.isConnected = false;
}
protected override bool IsConnected
{
get
{
return base.IsConnected;
}
}
}
}
to test it. But everytime I connect, I get a NullReferenceException:
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei SmartQuant.Instruments.DataManager.UKF3Ns8gP(Object , TradeEventArgs )
bei SmartQuant.Providers.ProviderManager.TrSc6nZMi(Object , TradeEventArgs )
bei OpenQuant.API.Plugins.SQProvider.EmitTrade(Instrument instrument, DateTime time, Double price, Int32 size)
Its in the line
Code:
base.EmitNewTrade(i, Clock.Now, p, 1);
I think it has something to do with the instrument. I have this instrument in the list of instruments in my strategy.
By the way: Is it possible to have more than one market data provider for a strategy? Because I had to set the Live trading Market Date Provider to my User Provider. I wonder then where my base system is getting the IB Market Data.