TickVolume - Displayed on the chart
27 Oct 2013, 16:53
Hi,
in this 3d:
is shown the following example for information displayed on the chart:
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)]
public class MultiSymbolMarketInfo : Indicator
{
private Symbol symbol1;
private Symbol symbol2;
private Symbol symbol3;
[Parameter(DefaultValue = "EURGBP")]
public string Symbol1 { get; set; }
[Parameter(DefaultValue = "GBPUSD")]
public string Symbol2 { get; set; }
[Parameter(DefaultValue = "EURUSD")]
public string Symbol3 { get; set; }
protected override void Initialize()
{
symbol1 = MarketData.GetSymbol(Symbol1);
symbol2 = MarketData.GetSymbol(Symbol2);
symbol3 = MarketData.GetSymbol(Symbol3);
}
public override void Calculate(int index)
{
if (!IsLastBar)
return;
var text = FormatSymbol(symbol1) + "\n" + FormatSymbol(symbol2) + "\n" + FormatSymbol(symbol3);
ChartObjects.DrawText("symbol1", text, StaticPosition.TopLeft, Colors.Lime);
}
private string FormatSymbol(Symbol symbol)
{
var spread = Math.Round(symbol.Spread / symbol.PipSize, 1);
return string.Format("{0}\t Ask: {1}\t Bid: {2}\t Spread: {3}", symbol.Code, symbol.Ask, symbol.Bid, spread);
}
}
}
I would like to also see the information "TickVolume".
I understand that I must use this:
public override void Calculate(int index)
{
double currentVolume = MarketSeries.TickVolume[index];
double previousVolume = MarketSeries.TickVolume[index-1];
}
I tried to change the code but failed.
Can you help me, please?

Spotware
29 Oct 2013, 15:50
If you are trying to access the tick volume of a specific series of another symbol then:
private MarketSeries series1; //... protected override void Initialize() { symbol1 = MarketData.GetSymbol(Symbol1); //... series1 = MarketData.GetSeries(symbol1, TimeFrame); //... } public override void Calculate(int index) { //... var openTime = MarketSeries.OpenTime[index]; var series1Index = GetIndexByDate(series1, openTime); var symbol1Volume = series1.TickVolume[series1Index]; }See GetIndexByDate method in this example
@Spotware