Topics
Replies
Giorgi_1
28 Jun 2024, 08:16
RE: RE: RE: RE: RE: Incorporation of different method's arguments in a new method
PanagiotisCharalampous said:
Giorgi_1 said:
PanagiotisCharalampous said:
Giorgi_1 said:
PanagiotisCharalampous said:
Hi there,
You can't just pass parameters to a method arbitrarily. If you want to record which mouse key was pressed, use Chart.KeyDown event
Best regards,
Panagiotis
Thanks Panagiotis, i did think the above wouldn't work, it was just more of an attempt to understand how i would achieve it. Could you show/explain how it could be achieved?
Thanks in advance
Hi there,
As per my previous post, if you want to capture which button was pressed you need to use the Chart.KeyDows event. Here is a small example
protected override void Initialize() { Chart.KeyDown += Chart_KeyDown; } private void Chart_KeyDown(ChartKeyboardEventArgs obj) { Print(obj.Key); }
Best regards,
Panagiotis
Thanks Panagiotis. Perhaps i can clarify further using code:
Do you know if it's possible to do something like:
private void Highlight_Click(ToggleButtonEventArgs obj, ChartKeyboardEventArgs keyobj)
{
if(keyobj.AltKey)
{
if(obj.ToggleButton.BackgroundColor == Color.Green)
{
Print("Option1");
}
}
if(!keyobj.AltKey)
{
if(obj.ToggleButton.BackgroundColor == Color.Green)
{
Print("Option2");
}
I'm trying to use a single method but incorporate the keydown events, as well as the togglebutton events. Is that something that can be done?
No this is not possible
No problem at all :) I wasn't sure if it was possible but i just didn't know how to do it, or if it wasn't possible at all.
Thanks for your help and time Panagiotis
@Giorgi_1
Giorgi_1
28 Jun 2024, 08:16
RE: RE: RE: RE: RE: Incorporation of different method's arguments in a new method
PanagiotisCharalampous said:
Giorgi_1 said:
PanagiotisCharalampous said:
Giorgi_1 said:
PanagiotisCharalampous said:
Hi there,
You can't just pass parameters to a method arbitrarily. If you want to record which mouse key was pressed, use Chart.KeyDown event
Best regards,
Panagiotis
Thanks Panagiotis, i did think the above wouldn't work, it was just more of an attempt to understand how i would achieve it. Could you show/explain how it could be achieved?
Thanks in advance
Hi there,
As per my previous post, if you want to capture which button was pressed you need to use the Chart.KeyDows event. Here is a small example
protected override void Initialize() { Chart.KeyDown += Chart_KeyDown; } private void Chart_KeyDown(ChartKeyboardEventArgs obj) { Print(obj.Key); }
Best regards,
Panagiotis
Thanks Panagiotis. Perhaps i can clarify further using code:
Do you know if it's possible to do something like:
private void Highlight_Click(ToggleButtonEventArgs obj, ChartKeyboardEventArgs keyobj)
{
if(keyobj.AltKey)
{
if(obj.ToggleButton.BackgroundColor == Color.Green)
{
Print("Option1");
}
}
if(!keyobj.AltKey)
{
if(obj.ToggleButton.BackgroundColor == Color.Green)
{
Print("Option2");
}
I'm trying to use a single method but incorporate the keydown events, as well as the togglebutton events. Is that something that can be done?
No this is not possible
No problem at all :) I wasn't sure if it was possible but i just didn't know how to do it, or if it wasn't possible at all.
Thanks for your help and time Panagiotis
@Giorgi_1
Giorgi_1
28 Jun 2024, 07:26
RE: RE: RE: Incorporation of different method's arguments in a new method
PanagiotisCharalampous said:
Giorgi_1 said:
PanagiotisCharalampous said:
Hi there,
You can't just pass parameters to a method arbitrarily. If you want to record which mouse key was pressed, use Chart.KeyDown event
Best regards,
Panagiotis
Thanks Panagiotis, i did think the above wouldn't work, it was just more of an attempt to understand how i would achieve it. Could you show/explain how it could be achieved?
Thanks in advance
Hi there,
As per my previous post, if you want to capture which button was pressed you need to use the Chart.KeyDows event. Here is a small example
protected override void Initialize() { Chart.KeyDown += Chart_KeyDown; } private void Chart_KeyDown(ChartKeyboardEventArgs obj) { Print(obj.Key); }
Best regards,
Panagiotis
Thanks Panagiotis. Perhaps i can clarify further using code:
Do you know if it's possible to do something like:
private void Highlight_Click(ToggleButtonEventArgs obj, ChartKeyboardEventArgs keyobj)
{
if(keyobj.AltKey)
{
if(obj.ToggleButton.BackgroundColor == Color.Green)
{
Print("Option1");
}
}
if(!keyobj.AltKey)
{
if(obj.ToggleButton.BackgroundColor == Color.Green)
{
Print("Option2");
}
I'm trying to use a single method but incorporate the keydown events, as well as the togglebutton events. Is that something that can be done?
@Giorgi_1
Giorgi_1
28 Jun 2024, 02:21
RE: Incorporation of different method's arguments in a new method
PanagiotisCharalampous said:
Hi there,
You can't just pass parameters to a method arbitrarily. If you want to record which mouse key was pressed, use Chart.KeyDown event
Best regards,
Panagiotis
Thanks Panagiotis, i did think the above wouldn't work, it was just more of an attempt to understand how i would achieve it. Could you show/explain how it could be achieved?
Thanks in advance
@Giorgi_1
Giorgi_1
26 Jun 2024, 14:03
RE: No Week DateTime function?
PanagiotisCharalampous said:
Hi there,
The DateTime class is a .Net 6.0 class, not a cTrader Algo API class. So this part is not developed by cTrader but by Microsoft.
Best regards,
Panagiotis
Thanks Panagiotis, i'll find a way around it.
Cheers!
@Giorgi_1
Giorgi_1
26 Jun 2024, 14:03
RE: No Week DateTime function?
PanagiotisCharalampous said:
Hi there,
The DateTime class is a .Net 6.0 class, not a cTrader Algo API class. So this part is not developed by cTrader but by Microsoft.
Best regards,
Panagiotis
Thanks Panagiotis, i'll find a way around it.
Cheers!
@Giorgi_1
Giorgi_1
07 Dec 2023, 08:43
RE: How to Reference a non interactive Trend Line object
PanagiotisCharalampous said:
Hi there,
Can you please share the complete cBot code? Are these lines drawn by the same cBot?
Best regards,
Panagiotis
Hi Panagiotis!
The lines were being drawn on cBot A, and the Print out on cBot B. I've now combined them, and they're working as expected.
So, essentially there is no issue. However, can you confirm that a non interactive Chart object can only be referenced by it's own cBot? And is that how it's meant to execute? In my mind, Chart.FindAllObjects would find all objects on the chart, regardless of their origin, perhaps my understanding is wrong?
Many Thanks,
@Giorgi_1
Giorgi_1
11 Aug 2023, 08:30
RE: SignalLineRepository and CalculatingY
PanagiotisChar said:
It's because there are two different types of objects. First change
private readonly ChartTrendLine _chartTrendLine;
In SignalLine class to
public ChartTrendLine ChartTrendLine;
and then try
foreach (var signalLine in SignalLineRepository.GetLines())
{
signalLine.ChartTrendLine.CalculateY(Server.Time);
}
You're a genius my friend!
That's it, thanks very much :) It also makes sense, so i can improve in the future.
Thanks again!
@Giorgi_1
Giorgi_1
11 Aug 2023, 07:19
RE: SignalLineRepository and CalculatingY
PanagiotisChar said:
Hi there,
What is a SignalLineRepository? Where did you find this?
Need help? Join us on Telegram
Hi @PanagiotisChar!
It is in the Sample Lines Trader code, here:
https://ctrader.com/forum/calgo-reference-samples/13504
It's one of the default scripts when you download cTrader, it's possible i've given the Class name, which is no help whatsoever! Sorry about that!
@Giorgi_1
Giorgi_1
07 Jul 2023, 10:54
RE:
Kaspricci said:
With plist.Add(highbars.HighPrices) you just add the whole list of high prices as one single element of your own list.
And actually you don't need a new list. HighPrices is already one. Just try this code below:
var highbars = MarketData.GetBars(TimeFrame.Daily, SymbolName); foreach(double price in highbars.HighPrices) { Print(price); }
Ah ok, i understand. I've added the list, not the elements of the list.
Thank you for clarifying :)
Do you know if there's a function or selection i can use to remove duplicates from a list?
@Giorgi_1
Giorgi_1
05 Jul 2023, 08:17
RE:
PanagiotisChar said:
Hi there,
There is no such method as far as I know.
Need help? Join us on Telegram
OK, i thought that may be the case.
Many Thanks,
@Giorgi_1
Giorgi_1
24 Oct 2024, 04:16
RE: Referencing a different chart CBot?
firemyst said:
Thanks firemyst, i did think of the external file solution, but thought there may be a more “built-in” solution. Something similar to the Sync Chart Objects Indicator that allows a change on one, to affect all. I'll keep looking and will update with any solution i find. If anyone does know if you're able to reference plug-ins from within a cBot, i'd be very interested as to how to implement it.
Many Thanks,
@Giorgi_1