Errors, bugs, questions - page 3126

 
Nikolai Semko #:

You form a data structure or an array of structures in an EA or in an indicator and send it to a resource.

Kanvas itself works with a graphical resource (OBJ_BITMAP_LABEL/ OBJ_BITMAP). So all that's left to do is to communicate the name of the resource to another application and it will easily access the pixels. It will also need to pass the pixel format. And you can read the pixels or change them with another CCanvas. It has a method, CCanvas::Attach, to attach it to an existing resource.

 
Nikolai Semko #:

What's the problem, Andrei?
Forming a data structure or an array of structures

No problems at all! It's just the extra work, that's what I'm talking about.

Any buffered indicator can be read by any other indicator or Expert Advisor.

For example, I have an EA that gets a list of running indicators and then creates them on a specified list of instruments/TF and then collects signals from them (and sends them to telegram). So any buffer indicator can simply be run on a chart and it will be picked up automatically. But kanvas indicator will have to be connected manually and then the rest of the work should be done manually.

We need to unify the work with kanvas indicators. I am afraid that this unification will result in ... buffer indicators))

 
Nikolai Semko #:

What's the problem, Andrei?

I didn't find one and didn't even look for one

 
Andrey Khatimlianskii #:

There's no problem! It's just unnecessary gestures, that's what I'm talking about.

Any buffer indicator can be read by any other indicator or EA, and a kanvas needs a kastum layer.

For example, I have an EA that gets a list of running indicators and then creates them on a specified list of instruments/TF and then collects signals from them (and sends them to telegram). So any buffer indicator can simply be run on a chart and it will be picked up automatically. But kanvas indicator will have to be connected manually and then the rest of the work should be done manually.

We need to unify the work with kanvas indicators. I am afraid that this unification will result in ... buffer indicators)).

I am talking about extending possibilities, including the use of the same classes for visualization, both in indicators and in Expert Advisors. In indicators, of course, there is always a buffer transfer method and no one forbids its use in case of pure canvas.
And by the way, I've already implemented a hybrid method of transferring, when an array of structures is transferred in one buffer via a union. Although there's an additional add-on needed on the receiving side, but firstly, it's not complicated, and secondly, it makes working with data of another indicator easier and more convenient for the user due to structures, not arrays of doubles. Users will definitely like this.
 
Mihail Matkovskij #:

Kanvas itself works with a graphical resource (OBJ_BITMAP_LABEL/ OBJ_BITMAP). So it remains to communicate the name of the resource to another application and it will easily access the pixels. It will also need to pass the pixel format. And you can read the pixels or change them with another CCanvas. It has a method called CCanvas::Attach to attach it to an existing resource.

It is unlikely that there will be a task of transferring a graphic, as it is often synchronised with the bars and price of the other window, and is integrated with the Event model.
The indicator window will not form if it is not present or it is not active.
If the indicator window doesn't exist, there is only way through iCustom using buffer or buffers. But, as I said before, you can put a structure or an array of structures into these buffers.
 
Andrei Trukhanovich #:

I couldn't find it and I wasn't even looking.

Thank you for reporting.
Now we know you don't
 
Nikolai Semko #:
Moreover, I think that the graphical resource will not even be generated if the indicator window does not exist or is not active.

I wonder in what cases if an indicator is running and its window doesn't exist? And when the window is inactive (the user has switched to another chart or minimized it), what resource is unloaded from memory, is it simply deleted?

Nikolai Semko #:
But, as I said before, you can put a structure or an array of structures into these buffers.

I think I agree with you there. I had to create a multitasking robot. The first application instance creates tasks and creates charts for them, then applies a special template with the same robot. Then the first robot creates the tasks and the robots created by the automaton execute them. The data transfer is done through resources. The strings of numbers and structures are transferred there. There is an example of data transfer via http here on the website (if memory serves me correctly). But the data about structures, their sizes and types go there first, and then the data itself. I have decided to make it easier in my Expert Advisor by passing the strings and numbers through an array of uchar-types in the form of strings that greatly simplifies the process of reading/writing. But I've never written bytes to indicator buffers and read them from there. But I already see one disadvantage of this method - the limited number of indicator bars. Although, there are 8 bytes in each cell of the array. Maybe it's not such a great disadvantage. Who knows...

 
Mihail Matkovskij #:

I wonder in what cases if an indicator is running but its window does not exist?

I meant using iCustom

And when the window is inactive (the user has switched to another chart or minimized it), what resource is unloaded from memory, is it simply deleted?

this was just my assumption, as there is no special point in forming images when the window is minimised. How it's implemented in MT - didn't check, but came across something similar. I've forgotten all the nuances.
Anyway it's unlikely that the resource is deleted, but it's not updated with time either. I.e. CCanvas::Update does not work

void CCanvas::Update(const bool redraw)
  {
//--- check
   if(m_rcname==NULL)
      return;
//--- update resource and redraw
   if(ResourceCreate(m_rcname,m_pixels,m_width,m_height,0,0,0,m_format) && redraw)
      ChartRedraw(this.m_chart_id);
  }
 
Nikolai Semko #:

I meant using iCustom

It turns out, you can pass values through the resource and buffers, but not through Kanvas resource. It's an interesting task, to call an indicator with output to Kanvas usingiCustom. I have not tried it. It seems to me that in this case there may be errors. Maybe, such an indicator loaded through iCustom won't work at all?

In any case, it's unlikely that the resource is deleted, but it doesn't update over time either. I.e. CCanvas::Update doesn't work.

I think ResourceCreate is working, but the result isn't rendered using ChartRedraw. Appeals to the function go, but the system understands that the chart doesn't need to be updated while it's inactive. But ifResourceCreate doesn't work,imagine that the indicator has updated data at a random tick when the chart is inactive, but Kanvas' resource has not been updated. And then the user has decided to activate this inactive chart and look at the indicator (Kanwa). And it turns out that there was a tick, but the Canva remains the same as it was before the user changed the chart. And what if during the period of inactivity there were a lot of ticks? Of course, the indicator would process them, but none of the results would be shown on the canvas.

 
Mihail Matkovskij #:

I think ResourceCreate works, but the result is not displayed with ChartRedraw.

Yes, you're probably right. This is likely to be the case.
And to save resources, it would be right to monitor window activity and not generate a bitmap if the window is not active.

It's worth checking rather than making assumptions.