Tick by Tick handling with Multiple data series  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
3strategy
Posts: 22
Joined: 31 Dec 2014
Has thanked: 2 times
Been thanked: 1 time

Tick by Tick handling with Multiple data series

Postby 3strategy » 08 Jan 2015

When trying to process an indicator "Tick by Tick" with 2 data series, calculations are not taking place in real time, but rather in buffered mode. Multiple calculations are taking place once there is a Trade (on the main series).

For example the below indicator, will take the "Trade" tick series, and the "Ask" tick series, as a second series. There are multiple Ask Size, and Ask Price ticks that arrive between Trades.
Instead of calculating and taking applicable action on each such change in the Ask series, the Indicator waits until there is a trade on the primary series.
I cannot put the Ask series as the first series, since in real life application I will depend on more than just these 2 series.
How can I fix this ?

Code: Select all

namespace PowerLanguage.Indicator{
[SameAsSymbol]
public class TickByTickHandling : IndicatorObject {
public TickByTickHandling(object _ctx):base(_ctx){}
private IPlotObject plot1;
private double askSize=0;
public double AskSize { get { return askSize; } set { if (askSize != value && value >0) { askSize = value; DoSomething(); } } }

protected override void Create() { // create variable objects, function objects, plot objects etc.
plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Point, Color.Red));
Output.Clear();
}
protected override void StartCalc() {}
protected override void CalcBar(){

if(BarsOfData(2).UpTicks[0]>0)
AskSize = BarsOfData(2).DownTicks[0] + BarsOfData(2).UpTicks[0];
Output.WriteLine(DateTime.Now.ToString("HH:mm:ss.ffffff")+" Last Trade vol:"+Bars.Volume[0]+" Ask:"+BarsOfData(2).VolumeValue +"/"+BarsOfData(2).DownTicks[0]+ "/"+BarsOfData(2).UpTicks[0] );
}
public void DoSomething()
{
Output.WriteLine(DateTime.Now.ToString("HH:mm:ss.ffffff")+" Did Something");
}
}
}
This can be seen in the below output, that shows time stamps of the multiple AskSize processing are actually all happening in the same time.

Code: Select all

19:09:48.381798 Last Trade vol:2 Ask:85/84/85
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:88/88/88
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:94/94/94
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:40/39/40
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:41/41/41
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:46/45/46
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:48/47/48
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:49/49/49
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:53/53/53
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:43/42/43
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:41/41/41
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:39/38/39
19:09:48.381798 Last Trade vol:2 Ask:39/38/39
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:42/41/42
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:43/43/43
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:46/46/46
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:43/43/43
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:50/49/50
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:57/56/57
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:58/58/58
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:59/59/59
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:60/59/60
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:56/56/56
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:2 Ask:54/54/54
19:09:48.381798 Last Trade vol:2 Ask:54/54/54
19:09:48.381798 Last Trade vol:1 Ask:54/54/54
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:1 Ask:65/65/65
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:1 Ask:67/67/67
19:09:48.381798 Last Trade vol:1 Ask:67/67/67
19:09:48.381798 Last Trade vol:1 Ask:67/67/67
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:1 Ask:76/76/76
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:1 Ask:85/85/85
19:09:48.381798 Did Something
19:09:48.381798 Last Trade vol:1 Ask:90/90/90
19:09:48.382798 Did Something
19:09:48.382798 Last Trade vol:1 Ask:92/91/92
19:09:48.382798 Last Trade vol:1 Ask:92/91/92
19:09:48.558808 Did Something
19:09:48.558808 Last Trade vol:1 Ask:93/92/93
19:09:48.558808 Did Something
19:09:48.558808 Last Trade vol:1 Ask:93/93/93
19:09:48.558808 Did Something
19:09:48.558808 Last Trade vol:1 Ask:97/97/97
19:09:48.558808 Last Trade vol:2 Ask:97/97/97
19:09:48.558808 Last Trade vol:7 Ask:97/97/97
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:98/97/98
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:98/98/98
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:100/99/100
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:107/107/107
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:119/119/119
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:120/119/120
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:121/121/121
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:125/125/125
19:09:50.138898 Did Something
19:09:50.138898 Last Trade vol:7 Ask:124/123/124

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Tick by Tick handling with Multiple data series

Postby Henry MultiСharts » 08 Jan 2015

Hello 3strategy,

Please make sure the Realtime-History Matching is configured correctly.

3strategy
Posts: 22
Joined: 31 Dec 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Tick by Tick handling with Multiple data series

Postby 3strategy » 09 Jan 2015

RealTimeHistoryMatching is checked.
The problem is observed in Real Time (not on the processing of the Historic ticks - where such buffering has no real effect).

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Tick by Tick handling with Multiple data series  [SOLVED]

Postby Henry MultiСharts » 09 Jan 2015

You need to uncheck the Realtime-History Matching option.


Return to “MultiCharts .NET”