Download MetaTrader 5

Drawing an indicator about previous trades?

To add comments, please log in or register
Use MQL5 Cloud Network. Test robots at a super speed!
AlliumPorrum
89
AlliumPorrum 2015.09.21 12:34 

Hi! I have a problem that I just can't find the solution for; I have an EA which has a few different methods for taking the trades. Now what I would like to do is to draw some sort of a line indicator of how these methods are doing against each other.

First I tried to find out if it is possible to draw lines to the chart (or even better, on own window) from the EA, but it doesn't seem to be possible.

Then I searched if indicators could access these trading methods such as OrderSelect etc., but they cannot :=(

So, is there any possible method for drawing a line to the chart/window, based on previous trades??

AlliumPorrum
89
AlliumPorrum 2015.09.21 14:50  
For example; is there any "common namespace" etc. in MT4, so that I could create an array where EA would write it's data, and then I could read that data from my indicator and draw a line based on it?
Stuart Browne
5819
Stuart Browne 2015.09.22 00:26  
AlliumPorrum:
For example; is there any "common namespace" etc. in MT4, so that I could create an array where EA would write it's data, and then I could read that data from my indicator and draw a line based on it?
There are a few ways to do it but if you're talking about "common namespace" then you should read up on Terminal Global Variables. All indicators/EAs running on the terminal have access to these globals so yes, you can communicate between different scripts in this way.
AlliumPorrum
89
AlliumPorrum 2015.09.22 08:22  
Stuart Browne:
There are a few ways to do it but if you're talking about "common namespace" then you should read up on Terminal Global Variables. All indicators/EAs running on the terminal have access to these globals so yes, you can communicate between different scripts in this way.

Hey that's interesting, thanks Stuart!

But did I understand correctly that it is not possible to use arrays that way, only individual values? If so, I would need to create an own global variable for every trade that my EA has made. I don't know if it a problem anyway, but that way there will surely be hundreds of variables after a while.

Or is there any other way to do it with arrays?

Stuart Browne
5819
Stuart Browne 2015.09.22 10:21  
Personally never tried it but I don't think you can store a global array. If you're looking at storing that much info then may be better to go with writing / reading to files ?
To add comments, please log in or register