Magic with Windows

 

I have another interesting project. My first assumption was to run it as an EA, but due to the nature of it, I think a script may be a better way to fire off this action.

Assumptions:
A CSV file exists that contains rows of data, the data is in this format:
buy/sell, symbol, entry point, initial stoploss, first stop, second stop

The code to read the CSV already exists.

Objectives:
1. Read the file - done
2. Open the symbol/pair chart that corresponds - problem
3. plot lines representing the data from the CSV - done
4. perform trades based on lines plotted - done.

So let's get to the problem. I have found plenty of code that shows how to open a subwindow for dropping indicators, but I cannot seem to find code that shows how to open and close symbol/pair chart windows. Do you know where I can find some code that demonstrates this?

Is there code that shows you how to drop an EA onto a chart?

Do I have the user drop a script on chart x, then from chart x, I have the code perform the closure of unwanted charts and open the desired charts or can this be done from the EA itself?

Performing the closure of other charts may effect the users ability to run multiple EAs in the same MT4, would this be a bad practice, should I not do it?

In the code sample you may know of is there a way to check for existance of the pair prior to attempting to open the chart window? I have code that will allow me to parse the raw pair text, such as taking EURUSD out of EUR/USD or EURUSD_fx, etc, i believe I can do the same for the pair data from the symbols collection. I just need to query it's existance prior to attempting to open.

 
LEHayes:

I have another interesting project. My first assumption was to run it as an EA, but due to the nature of it, I think a script may be a better way to fire off this action.

Assumptions:
A CSV file exists that contains rows of data, the data is in this format:
buy/sell, symbol, entry point, initial stoploss, first stop, second stop

The code to read the CSV already exists.

Objectives:
1. Read the file - done
2. Open the symbol/pair chart that corresponds - problem
3. plot lines representing the data from the CSV - done
4. perform trades based on lines plotted - done.

So let's get to the problem. I have found plenty of code that shows how to open a subwindow for dropping indicators, but I cannot seem to find code that shows how to open and close symbol/pair chart windows. Do you know where I can find some code that demonstrates this?

Is there code that shows you how to drop an EA onto a chart?

Do I have the user drop a script on chart x, then from chart x, I have the code perform the closure of unwanted charts and open the desired charts or can this be done from the EA itself?

Performing the closure of other charts may effect the users ability to run multiple EAs in the same MT4, would this be a bad practice, should I not do it?

In the code sample you may know of is there a way to check for existance of the pair prior to attempting to open the chart window? I have code that will allow me to parse the raw pair text, such as taking EURUSD out of EUR/USD or EURUSD_fx, etc, i believe I can do the same for the pair data from the symbols collection. I just need to query it's existance prior to attempting to open.

You can attach your EA/script to a single chart window and make it trade on any symbol you want without opening and closing any windows.

 
LEHayes:

In the code sample you may know of is there a way to check for existance of the pair prior to attempting to open the chart window? I have code that will allow me to parse the raw pair text, such as taking EURUSD out of EUR/USD or EURUSD_fx, etc, i believe I can do the same for the pair data from the symbols collection. I just need to query it's existance prior to attempting to open.

Here is an 'included' file that is a rather crude but effective method for multiple descriptions of the same currency pairs.
 
robofx.org wrote >>

You can attach your EA/script to a single chart window and make it trade on any symbol you want without opening and closing any windows.


please tell me more, this sounds interesting. I don't know if this will provide the solution I am looking for but it does sound interesting.
 
FourX wrote >>
Here is an 'included' file that is a rather crude but effective method for multiple descriptions of the same currency pairs.


Thank you, I will check it out.

 
LEHayes:


please tell me more, this sounds interesting. I don't know if this will provide the solution I am looking for but it does sound interesting.

Since you read your entry signals from external file you can use OrderSend("EURUSD",... ) or replace "EURUSD" with a variable containing pair info from your file.
From a single chart you can execute OrderSend() for any pair.

 

The idea is that I want to read from the file the pair needed and then open the pairs chart, then apply an EA to it. Once the EA is applied, the EA will perform the buys and sells according to it's design. Just trying to make the users life easier with the setup.

 

Visually exciting to the user but probably unnecssariy. An EA is an Object - Data and methods(programs) attached to another Object called a chart both the chart object is attached to the MT4 platform.
When you ask to display a chart an 'instance' of one is created and displayed. The MT4 platform basically watches and save a datastream from the brokers server - meaning all the info you need is available
all the time. Charts and EA use the 'Event' of a data packet(tick) with its symbol to fire of methods which if EA is attached fire that off too. Your problem is that you don't have a 'universal' tick.
-
I can be wrong - but that is how I imagine it to be constructed

 

So you comment in summary is that in order for this EA to open other charts, this EA has to be on a chart with a tick in order to fire off the opening of the other charts, this is fine, but, the alternative may be to have the user fire off a setup/ start script instead. Scripts are not based on charts and do not require the tick event. So, it could possibly perform the opening of the charts and application of the EAs.

 

Not learned enough yet to answer that. There does not seem to be a technical in depth manual available for MT4. So left with a lot of guesswork based on limited personal experience.
I know that I can drag and drop a symbol from the MarketWatch window and drop it onto a chart window. Is it possible to do the same thing from a script or dll?
A chart must at some point do a compare of incomming tick symbol to symbol attached to chart. Can this check be replaced or altered?
-
Beyond what I have experince of would be to use the windows winsock or windows message buffer and grab all the ticks.

Reason: