reading a text from one chart and sending on another chart

 

hello guys,

I have an EA which is made signal by text on chart, how can I send the text from the signal chart to a new one then I could auto trading on second chart. 


Thank you for  your reply ...

 
Morteza Parvandi :

hello guys,

I have an EA which is made signal by text on chart, how can I send the text from the signal chart to a new one then I could auto trading on second chart. 


Thank you for  your reply ...

The correct option is to create an OBJ_LABEL object on the chart (which receives messages). When a signal appears, you simply change the text in this object.

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_LABEL
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_LABEL
  • www.mql5.com
//| Create a text label                                              |               chart_ID=0,                               sub_window=0,                             x=0,                                      y=0,                                      font_size=10,                          angle=0.0,                ...
 
Vladimir Karputov:

The correct option is to create an OBJ_LABEL object on the chart (which receives messages). When a signal appears, you simply change the text in this object.

...or simply send the signal event to the other/all chart(s) using EventChartCustom ;)
 
Anonymous3 Geek:
...or simply send the signal event to the other/all chart(s) using EventChartCustom ;)
Unfortunate this EA has not Auto trading and it only write a text on chart as you know I can't using the another EA on the same chart and Script only works one event on start because this EA change Sell or Buy.... so I think could i send the text on the same chart and using it as auto trading...
 
Vladimir Karputov:

The correct option is to create an OBJ_LABEL object on the chart (which receives messages). When a signal appears, you simply change the text in this object.

Unfortunate this EA has not Auto trading and it only write a text on chart as you know I can't using the another EA on the same chart and Script only works one event on start because this EA change Sell or Buy.... so I think could i send the text on the same chart and using it as auto trading...
 
Morteza Parvandi :
Unfortunate this EA has not Auto trading and it only write a text on chart as you know I can't using the another EA on the same chart and Script only works one event on start because this EA change Sell or Buy.... so I think could i send the text on the same chart and using it as auto trading...

No need to write text on the chart (using 'Comment') - someone can erase the comment on the chart. Write to OBJ_LABEL   object

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_LABEL
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_LABEL
  • www.mql5.com
//| Create a text label                                              |               chart_ID=0,                               sub_window=0,                             x=0,                                      y=0,                                      font_size=10,                          angle=0.0,                ...
 

You can code and load an indicator on that same chart that intercepts the message and use another EA (on another chart) to process the message and handle the trading capabilities.

But it could be A LOT easier to just code one EA that does all of it at once.

 
Marco vd Heijden:

You can code and load an indicator on that same chart that intercepts the message and use another EA (on another chart) to process the message and handle the trading capabilities.

But it could be A LOT easier to just code one EA that does all of it at once.

I can't because I bought this EA and it is copy righted. 
Vladimir Karputov:

No need to write text on the chart (using 'Comment') - someone can erase the comment on the chart. Write to OBJ_LABEL   object

I'm writing this code on Script only shows comment when I dragging it on the chart.

 

You should specify the type of this text first.

What is it ?

Is it a Comment then use  

string comment = ChartGetString(0,CHART_COMMENT);

If its a graphical text object then use the text property of the graphical object

OBJPROP_TEXT

Instead.

Once your indicator obtained the value push it up to a global terminal variable so that your other EA can read it.

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
When a graphical object is created using the ObjectCreate() function, it's necessary to specify the type of object being created, which can be one of the values of the ENUM_OBJECT enumeration. Further specifications of object properties are possible using functions for working with graphical objects.
 
Marco vd Heijden:

You should specify the type of this text first.

What is it ?

Is it a Comment then use  

If its a graphical text object then use the text property of the graphical object

Instead.

Sorry this EA Made Label Text as you can see on first picture and the second one the code which I'm using to comment the EA Label Text on the chart. my problem is how to write a code on the script which act auto trading... or the main problem is this script only show this comment on chart when I drag it on the chart... 
 
Morteza Parvandi:

Hi again now I could code an indicator which print EA signal, but how can I using it on another chart?

You can use the ChartID to select a chart and the ObjectName to select a object.

So you can create objects on all open charts from one EA or indicator or script by using the correct ChartID in the parameters.

https://www.mql5.com/en/docs/chart_operations/chartid

This Chart ID is usually the first parameter you specify in the object functions.

https://www.mql5.com/en/docs/objects/objectstotal

https://www.mql5.com/en/docs/objects/objectname

Documentation on MQL5: Chart Operations / ChartID
Documentation on MQL5: Chart Operations / ChartID
  • www.mql5.com
ChartID - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: