Making an EA that can view portions of charts as we can see them - page 2

 
WHRoeder:
Morons to the left of me, idiots to the right, stuck in the middle with you! We're in trouble now. ;)

See what you have done now, just about to go to bed an I have to look up who sang the song ah of course, Joe Egan and Gerry Rafferty

https://www.youtube.com/watch?v=DohRa9lsx0Q

 
Okay, I went to the Book and read on for a while. I came across the sentence "You can attach only one EA in one symbol window; the simultaneous use of several Expert Advisors is prohibited." I want to make an EA that will take into account indicators from two different time frames before making a trade on one of the time frames. Is this possible? Also is it possible to run trades on a window the EA is not attatched to? ie an EA monitoring multiple currencies?
 
bkhan:
I want to make an EA that will take into account indicators from two different time frames before making a trade on one of the time frames. Is this possible?

Yes. Specify the timeframe and bar number on that timeframe in the iCustom() call

bkhan:
Also is it possible to run trades on a window the EA is not attatched to? ie an EA monitoring multiple currencies?
Yes, you specify the symbol when you send the Order . . . you will not be able to test using the Strategy tester though . . .
 
bkhan: "You can attach only one EA in one symbol window; the simultaneous use of several Expert Advisors is prohibited."

That means you can NOT have multiple EAs on ONE chart. You can always have the same EA on multiple (different) charts or multiple EAs on multiple charts. As long as it (they) uses magic numbers correctly.

You can do trades with other pairs as RaptorUK said. Just don't do it. Write the EA to trade the current symbol and put it on multiple charts. If you do it you can't use the tester, can't use any predefines, etc..

 

I really appreciate your help guys. Here's another possible moronic/idiotic question:

I've been messing around with iCustom and am better understanding mql4. Anyways, I have three indicators, one indicator which has a line and displays it in one of two colors, the second is a bar(with no value) with one of two colors, and the third is a histogram (also one of two colors) along with two lines (color irrelevant)

Basically, for all three indicators I need to figure out the color it is showing at the moment. For the last indicator, I need the color, the histogram bottom and top values, and the postion of both lines.

I cannot access the indicator code (I dont know if thats necasary)

How would i go about figuring colors/values out? I've messed around with the mode values in iCustom but none of the values I get really correspond to one color or another let alone histogram positions. Also I dont know how to access external variables of my indicators if thats necessary.

 

This is all the code in the start method:

Alert( iCustom(NULL, 0, "I1",, 2, 0)," ", iCustom(NULL, 0, "I2",, 2, 0)," ", iCustom(NULL, 0, "I3",, 2, 0) );

I left the mode area blank for now because I cannot figure what goes there. When running it, I just inserted null there.

 
bkhan:

I really appreciate your help guys. Here's another possible moronic/idiotic question:

I've been messing around with iCustom and am better understanding mql4. Anyways, I have three indicators, one indicator which has a line and displays it in one of two colors, the second is a bar(with no value) with one of two colors, and the third is a histogram (also one of two colors) along with two lines (color irrelevant)

Basically, for all three indicators I need to figure out the color it is showing at the moment. For the last indicator, I need the color, the histogram bottom and top values, and the postion of both lines.

I cannot access the indicator code (I dont know if thats necasary)

How would i go about figuring colors/values out? I've messed around with the mode values in iCustom but none of the values I get really correspond to one color or another let alone histogram positions. Also I dont know how to access external variables of my indicators if thats necessary.

Each colour has a different buffer, put the Indicators on a chart open up the Data Window ( Ctrl + D ) and move your cursor around the indicator lines, bars, histograms, the Data Window will show you the values and the buffers, the first top buffer is 0. From here you can determine which buffers are for whic colours . . .
 

bkhan:

Alert( iCustom(NULL, 0, "I1",, 2, 0)," ", iCustom(NULL, 0, "I2",, 2, 0)," ", iCustom(NULL, 0, "I3",, 2, 0) );

I left the mode area blank for now because I cannot figure what goes there. When running it, I just inserted null there.

  1. You didn't leave the mode area blank, you set it to 2. You left the parameters area blank. (drop the extra comma)
  2. Detailed explanation of iCustom - MQL4 forum
  3. For color indicators one buffer will empty (Either EMPTY_VALUE, or zero) the other will have a value. Like RaptorUK said, you have to figure out which is which, either data window, or the code.



 

Thank you both very much that portion of my works now!!

But I've come across another set of problems. Im trying to figure out what the best way to find out if there is a current trade going? This is what I tried.

if(OrderSelect(currentOrder,SELECT_BY_POS)==true)

{

datetime orderExists=OrderCloseTime();

}

else

{

orderExists=OrderCloseTime();

}

if (orderExists!=0)
{
Alert("There is not current order");
}

currentOrder is the ticket number only set by the EA when it makes a trade. So when the EA starts that value is zero, which I know will screw this up. Any alternatives?

 
bkhan:

But I've come across another set of problems. Im trying to figure out what the best way to find out if there is a current trade going? This is what I tried.

if(OrderSelect(currentOrder,SELECT_BY_POS)==true)

currentOrder is the ticket number only set by the EA when it makes a trade. So when the EA starts that value is zero, which I know will screw this up. Any alternatives?

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. If "currentOrder is the ticket number" why are you selecting by position?
  3. If you accidentally close the terminal, get BSOD, power glitch, etc and restart the terminal, what are you going to do then? your variable has no value. Use a orderSelect loop to find your orders.
Reason: