Expert Advisor Builder for MT4 - page 2

 

That's been out for a while. It works, once you get tha hang of it's usage.

 

I have a small routine to trace wins/losses when they get erased from a chart:

ObjectsDeleteAll( EMPTY, OBJ_TREND );

for( i = 0; i < HT; i++ )

if( OrderSelect( i, SELECT_BY_POS, MODE_HISTORY ) )

{

ObjectCreate( "TrendH"+i, OBJ_TREND, 0, OrderOpenTime(), OrderOpenPrice(), OrderCloseTime(), OrderClosePrice());

ObjectSet( "TrendH"+i, OBJPROP_WIDTH, 2 );

ObjectSet( "TrendH"+i, OBJPROP_RAY, False );

ObjectSet( "TrendH"+i, OBJPROP_STYLE, STYLE_DOT );

if ( OrderType()==OP_BUY )

if ( OrderOpenPrice() < OrderClosePrice() ) ObjectSet( "TrendH"+i, OBJPROP_COLOR, Green );

else ObjectSet( "TrendH"+i, OBJPROP_COLOR, Red );

else if ( OrderType()==OP_SELL )

if ( OrderOpenPrice() > OrderClosePrice() ) ObjectSet( "TrendH"+i, OBJPROP_COLOR, Green );

else ObjectSet( "TrendH"+i, OBJPROP_COLOR, Red );

}

Of course, anybody can use any of this that you want in your EA.

Problem is, I'd like the OBJPROP_STYLE line to function and it doesn't. Does anybody know of a resource that tells you which properties apply to which objects? You'd think STYLE applies to trendline object types, but it doesn't seem to, unless there's still another property that turns this one on/off. Any help would be appreciated.

 

Sorry - you also need:

int i = 0;

int HT = OrdersHistoryTotal();

(I know anybody who uses this should be able to figure this out, but...)

 
scorpion:
How come? Maybe you're a coder?

I wouldn't call myself a coder, but I do write my own EA's. Here is the most complete manual of MQL4 that I know of:


If it doesn't work as a link, just go to the site and look for a manual. It is great. Good luck guys!

 

Hi scorpion

Im David beh me very in this forum can you tell me where to start if i want to ask about fx mt4 setting of GBP/USD entry to buy and sell signal.

Thanks and cheers

Beh

scorpion:
Hi alertfx, other members may know, but I don't. Since the syntax looks familiar, I just know how to code. In fact somebody answered this question already, so you may want to search the forum for it. Good luck!
 

Hey Scorp - do you know why, if I can make a trend line into a ray, change it's color, etc., I can't set it to dot or dot-dash? Any reason why this won't work?

Misfx - I haden't seen that manual, but I have it now. Thanks. - Bill

 

the online version has greatly evolved now, it's now version of 24 apr 2007 and can actually produce working EA (i did not say profitable)

 

I have an EA with SL=50.

I will change it to have : SL =50 OR MACD < Previous MACD (example).

How code it ?

Thanks in advance.

Jo

 
Jovager:
I have an EA with SL=50. I will change it to have : SL =50 OR MACD < Previous MACD (example). How code it ? Thanks in advance. Jo

Where are the codes? Pasted the code of the ea here and we can help you out.

 

Thanks Bossxero for your interest.

What I want it is a stop when the trade goes against me, i.e. when the conditions become the conditions opposite of the opening of the trade.

Best, if it's not too much workis would be a stop and reverse.

Thanks again.

Jo

Files:
Jovager.mq4  10 kb