I got the same issue recently. When I would try to use any objects like Trend Line or Fibonacci Fan and etc. it will get out of mouse control when market is ticking but when a symbol stopped or disabled I can draw properly. Using cTrader 4.8.28 on Errante
Hi there,
Could you pleasesend us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.
Best regards,
I made a simple indicator that will cause this issue to occur 100% of the times. The line causing the issue is DrawText or drawing anything every tick, if I am drawing something or drawing on the chart window, the object will lose focus as soon as Calculate is invoked on the indicator.
Code below:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using cAlgo.API;using cAlgo.API.Collections;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo{ [Indicator(AccessRights = AccessRights.None, IsOverlay = false)] public class DrawingBug : Indicator { public override void Calculate(int index) { IndicatorArea.RemoveObject("test"); IndicatorArea.DrawText("test", "BUG!!!", Bars.Last().OpenTime, 0, Color.Red); } }}
Hi razor_00,
Thank you, I have forwarded this to the product team for resolution. In the meanwhile, the issue is caused by the RemoveObject method, which in this case is redundant, you don't need to remove an object in order to redraw it. If you remove that line of code, it should fix the problem.
Best regards,
Panagiotis
Thanks for your reply, I will modify my indicator, anyway the remove and draw calls should not call this behaviour, is that correct? Is that going to be fixed in future versions?
Yes that is correct, we will fix this in an upcoming version
Could you pleasesend us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.
Thank you for reporting this issue. Could you pleasesend us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.
You can use a flag to achieve this e.g. bool CanTrade. Set it to false when a trade is taken and then set it back to true when a new bar is opened.
Best regards,
Panagiotis
Thanks Panagiotis,
I have attempted the code below, but believe I am missing something as it places multiple trades per bar, but trader per bar after bar is opened. I attempted to limit positions with Positions.Count, but that stops it being placed per bar.
protected override void OnTick() { if (IncludeBreakEven == true) GoToBreakEven();
var Ema1 = _ema1.Result.Last(0); var Ema2 = _ema2.Result.Last(0); var Ema1i = _ema1.Result.Last(2); var Ema2i = _ema2.Result.Last(2); var Ema3 = _ema3.Result.LastValue; var rising = _ema1.Result.IsRising(); var falling = _ema2.Result.IsFalling(); var rising2 = _ema2.Result.IsRising(); var falling2 = _ema1.Result.IsFalling();
I got the same issue recently. When I would try to use any objects like Trend Line or Fibonacci Fan and etc. it will get out of mouse control when market is ticking but when a symbol stopped or disabled I can draw properly. Using cTrader 4.8.28 on Errante
Hi there,
Could you pleasesend us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.
Best regards,
I made a simple indicator that will cause this issue to occur 100% of the times. The line causing the issue is DrawText or drawing anything every tick, if I am drawing something or drawing on the chart window, the object will lose focus as soon as Calculate is invoked on the indicator.
Code below:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using cAlgo.API;using cAlgo.API.Collections;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo{ [Indicator(AccessRights = AccessRights.None, IsOverlay = false)] public class DrawingBug : Indicator { public override void Calculate(int index) { IndicatorArea.RemoveObject("test"); IndicatorArea.DrawText("test", "BUG!!!", Bars.Last().OpenTime, 0, Color.Red); } }}
Hi razor_00,
Thank you, I have forwarded this to the product team for resolution. In the meanwhile, the issue is caused by the RemoveObject method, which in this case is redundant, you don't need to remove an object in order to redraw it. If you remove that line of code, it should fix the problem.
PanagiotisCharalampous
12 Jan 2024, 07:29
Hi there,
Please explain what exact help to you need. Nobody will do the job for you but we are happy to help you do it yourself
Best regards,
Panagiotis
@PanagiotisCharalampous