Hi there
Finally I've built the engine that receives and process ticks, I've created the compression logic for the different frequencies.
A frequency can be of either Time, Volume, Ticks or Range.
The system is 100% event driven and the architecture is based at a service bus for transportation between UI, Core and TickEngine.
I will not go into too much details right now.. not that anything is secret, but just because the project is driven in a very agile way.
Anyway....
Here goes the Strategy:
************************************************************
public class BuySMACrosses: TickEngine.Base.StrategyRunner
{
ICompression compression;
List<ISeries> barBuffer;
public override void StartUp()
{
-> Look at the compression... 100% fully flexible
nice ehh...
this.compression = base.CompressionEngine<Time>(TimeSpan.FromSeconds(60));
-> we could easily use another compression.. ie.
this.compressionWith10Min = base.CompressionEngine<Time>(TimeSpan.FromMinutes(10));
-> or maybe...
this.compressionWithTick = base.CompressionEngine<Tick>(100);
-> these compressions can freely be mixed in the indicators and signals...
-> Just event subscriptions
this.compression.OHLCUpdated += new EventHandler(compression_OHLCUpdated);
this.compression.Close.CurrentChanged += new EventHandler(Close_CurrentChanged);
-> A barbuffer... not sure exactly what this is needed for. Maybe this should be handled from the initiator of this Strategy. I think it could be clever to share a bar buffer between different strategies...
Opinions?
this.barBuffer = new List<Common.Entities.ISeries>();
-> Some indicator... that uses the compression.Low, in this example 1 minut Bar Low
-> We can add as many as we like, based at different compressions
var sma9 = new Ballonprofit.Indicators.Trend.SMA(compression.Low, 9);
sma9.CurrentChanged += new EventHandler(sma9_OnChange);
}
void compression_OHLCUpdated(object sender, EventArgs e)
{
throw new NotImplementedException();
}
void Close_CurrentChanged(object sender, EventArgs e)
{
this.barBuffer.Add( this.compression.Close ); // add maybe to a shared buffer
}
void sma9_OnChange(object sender, EventArgs e)
{
System.Diagnostics.Trace.WriteLine("sma9_OnChange");
}
//why should we even want to do something like this?. Well I built it, but very influenced by people and their obsession with "do something on a tick"-thing
protected override void OnTick(Common.Entities.ITickData tickData)
{
System.Diagnostics.Trace.WriteLine("OnTick recieved");
}
}
************************************************************
I would like to discuss my approach to the subject
how intuitive this is?, any pitfalls etc?
Something I do have in mind, but not yet developed is the different signals.. crossover, crossunder etc. could be done like the following:
var cross = sma9.Crosses(sma21);
cross.Signal += (s, e) => e.Symbol.PositionOpen(1);
What do you think?
Finally I've built the engine that receives and process ticks, I've created the compression logic for the different frequencies.
A frequency can be of either Time, Volume, Ticks or Range.
The system is 100% event driven and the architecture is based at a service bus for transportation between UI, Core and TickEngine.
I will not go into too much details right now.. not that anything is secret, but just because the project is driven in a very agile way.
Anyway....
Here goes the Strategy:
************************************************************
public class BuySMACrosses: TickEngine.Base.StrategyRunner
{
ICompression compression;
List<ISeries> barBuffer;
public override void StartUp()
{
-> Look at the compression... 100% fully flexible
nice ehh...this.compression = base.CompressionEngine<Time>(TimeSpan.FromSeconds(60));
-> we could easily use another compression.. ie.
this.compressionWith10Min = base.CompressionEngine<Time>(TimeSpan.FromMinutes(10));
-> or maybe...
this.compressionWithTick = base.CompressionEngine<Tick>(100);
-> these compressions can freely be mixed in the indicators and signals...

-> Just event subscriptions
this.compression.OHLCUpdated += new EventHandler(compression_OHLCUpdated);
this.compression.Close.CurrentChanged += new EventHandler(Close_CurrentChanged);
-> A barbuffer... not sure exactly what this is needed for. Maybe this should be handled from the initiator of this Strategy. I think it could be clever to share a bar buffer between different strategies...
Opinions?
this.barBuffer = new List<Common.Entities.ISeries>();
-> Some indicator... that uses the compression.Low, in this example 1 minut Bar Low
-> We can add as many as we like, based at different compressions
var sma9 = new Ballonprofit.Indicators.Trend.SMA(compression.Low, 9);
sma9.CurrentChanged += new EventHandler(sma9_OnChange);
}
void compression_OHLCUpdated(object sender, EventArgs e)
{
throw new NotImplementedException();
}
void Close_CurrentChanged(object sender, EventArgs e)
{
this.barBuffer.Add( this.compression.Close ); // add maybe to a shared buffer
}
void sma9_OnChange(object sender, EventArgs e)
{
System.Diagnostics.Trace.WriteLine("sma9_OnChange");
}
//why should we even want to do something like this?. Well I built it, but very influenced by people and their obsession with "do something on a tick"-thing

protected override void OnTick(Common.Entities.ITickData tickData)
{
System.Diagnostics.Trace.WriteLine("OnTick recieved");
}
}
************************************************************
I would like to discuss my approach to the subject
how intuitive this is?, any pitfalls etc?Something I do have in mind, but not yet developed is the different signals.. crossover, crossunder etc. could be done like the following:
var cross = sma9.Crosses(sma21);
cross.Signal += (s, e) => e.Symbol.PositionOpen(1);
What do you think?
