There is no Open, High, Low, Close & Time information displayed in cTrader on MAC
There is no Open, High, Low, Close & Time information displayed in cTrader on MAC
30 Nov 2024, 12:47
Hello to you all,
can you please help me? I have cTrader installed on my MAC. There is no Open, High, Low, Close & Time information displayed when I hold my pointer next to a bar.
How can I enable this function? or at least please help me with the indicator that I wrote. I get an error and do not know how to get past it. I pasted it below
I tried many other methods but still, none works.
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using System;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class BarInfoIndicator : Indicator
{
private const string InfoTextId = "BarInfoText";
public override void Calculate(int index)
{
// No calculations required; logic is handled in the mouse event
}
protected override void Initialize()
{
// Subscribe to mouse move event
Chart.MouseMove += OnMouseMove;
}
private void OnMouseMove(ChartMouseEventArgs args)
{
// Get the bar index from the mouse position
int barIndex = Chart.CoordinatesToIndex(args.MousePosition.X);
// Validate the bar index
if (barIndex < 0 || barIndex >= Bars.Count)
{
Chart.RemoveObject(InfoTextId);
return;
}
// Retrieve bar details
double open = Bars.OpenPrices[barIndex];
double high = Bars.HighPrices[barIndex];
double low = Bars.LowPrices[barIndex];
double close = Bars.ClosePrices[barIndex];
DateTime time = Bars.OpenTimes[barIndex];
// Build the display text
string displayText = $"O: {open:F2}, H: {high:F2}, L: {low:F2}, C: {close:F2}, Time: {time:yyyy-MM-dd HH:mm}";
// Display or update the text on the chart
Chart.DrawText(
InfoTextId,
displayText,
args.MousePosition.X,
Chart.TopY,
VerticalAlignment.Top,
HorizontalAlignment.Center,
Color.White
);
}
public override void Remove()
{
// Clean up when the indicator is removed
Chart.MouseMove -= OnMouseMove;
Chart.RemoveObject(InfoTextId);
}
}
}
Error CS0115: 'BarInfoIndicator.Remove()': no suitable method found to override (/Users/alexandruspinu/cAlgo/Sources/Indicators/Display OHLC/Display OHLC/Display OHLC.cs, line: 58, column: 30)
Replies
alecs.spinu
02 Dec 2024, 07:54
RE: There is no Open, High, Low, Close & Time information displayed in cTrader on MAC
PanagiotisCharalampous , hi, thanks for your reply
I have tried this option but it's not so useful as the way that cTrader web displayes OHLC and time for each bar when I move my mouse arround it.
Is there a way to create an indicator (same as the one I posted above) that does this?
Or is this functionality going to be implemented by developers anytime soon? All the other platforms (web and desktop) already have this enabled, but the MAC version doesen't.
example from the web version:
Regards,
Alex
@alecs.spinu
PanagiotisCharalampous
02 Dec 2024, 07:15
Hi there,
You need to use the market snapshot
Best regards,
Panagiotis
@PanagiotisCharalampous