ChartObjectsUpdatedEventArgs won't get triggered by program update objects?
ChartObjectsUpdatedEventArgs won't get triggered by program update objects?
25 Jun 2023, 03:17
Hello,
I have below pieces of code, in which I want the variable i_objchg to record how many times the icon's comment has been changed.
When I manually update the icon's comments, i_objchg seems working well to +1. But, when I update the icon's comment by another indicator or bots, it seems the ChartObjectsUpdatedEventArgs doesn't get triggered.
Can anyone help to confirm, if is this the case cTrader won't trigger ChartObjectsUpdatedEventArgs if the Object is updated by another indicator or bot?
Thanks.
protected override void OnStart()
{
Chart.ObjectsUpdated += Chart_ObjectsUpdated;
}
private void Chart_ObjectsUpdated(ChartObjectsUpdatedEventArgs obj)
{
var Ics = Chart.SelectedObjects.Where(x => x.ObjectType == ChartObjectType.Icon);
foreach (ChartIcon ic in Ics) { if ( ic.Comment!=s_icncmt ) { i_objchg++; } }
}
( Variable s_icncmt recorded the comment of the icon when it was selected. )
Replies
Spotware
26 Jun 2023, 10:53
Dear trader,
Our team has investigated this issue further and it seems that the feature is working as designed. The events are triggered only for interactive objects. If you want to the event to be triggered for an object added by the cBot, you need to set the IsInteractive property to true.
Best regards,
cTrader Team
@Spotware
Capt.Z-Fort.Builder
26 Jun 2023, 23:25
( Updated at: 26 Jun 2023, 23:28 )
RE:
Thank you very much for your clarification. It totally makes sense.
★░░░░░░░░░░░████░░░░░░░░░░░░░░░░░░░░★
★░░░░░░░░░███░██░░░░░░░░░░░░░░░░░░░░★
★░░░░░░░░░██░░░█░░░░░░░░░░░░░░░░░░░░★
★░░░░░░░░░██░░░██░░░░░░░░░░░░░░░░░░░★
★░░░░░░░░░░██░░░███░░░░░░░░░░░░░░░░░★
★░░░░░░░░░░░██░░░░██░░░░░░░░░░░░░░░░★
★░░░░░░░░░░░██░░░░░███░░░░░░░░░░░░░░★
★░░░░░░░░░░░░██░░░░░░██░░░░░░░░░░░░░★
★░░░░░░░███████░░░░░░░██░░░░░░░░░░░░★
★░░░░█████░░░░░░░░░░░░░░███░██░░░░░░★
★░░░██░░░░░████░░░░░░░░░░██████░░░░░★
★░░░██░░████░░███░░░░░░░░░░░░░██░░░░★
★░░░██░░░░░░░░███░░░░░░░░░░░░░██░░░░★
★░░░░██████████░███░░░░░░░░░░░██░░░░★
★░░░░██░░░░░░░░████░░░░░░░░░░░██░░░░★
★░░░░███████████░░██░░░░░░░░░░██░░░░★
★░░░░░░██░░░░░░░████░░░░░██████░░░░░★
★░░░░░░██████████░██░░░░███░██░░░░░░★
★░░░░░░░░░██░░░░░████░███░░░░░░░░░░░★
★░░░░░░░░░█████████████░░░░░░░░░░░░░★
★░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░★
Spotware said:
Dear trader,
Our team has investigated this issue further and it seems that the feature is working as designed. The events are triggered only for interactive objects. If you want to the event to be triggered for an object added by the cBot, you need to set the IsInteractive property to true.
Best regards,
cTrader Team
@Capt.Z-Fort.Builder
Spotware
26 Jun 2023, 09:43 ( Updated at: 26 Jun 2023, 09:49 )
Dear trader,
This behavior is a bug and it will be fixed in an upcoming update of the platform.
Best regards,
cTrader Team
@Spotware