Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 3
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-30-2005, 11:46 PM
harrywd harrywd is offline
Junior Member
 
Join Date: Nov 2005
Posts: 2
harrywd is on a distinguished road
EasyLanguage to Mql3

Can anyone help be convert an EasyLanguage program to a MQL3 program.
I got as far as getting it compiled, but it won't work yet on my DEMO account.
Currently the code is as follows:

1. When I try to compile the statement below using .00025 instead of 25/100000, I get an error.
Have I got a switch set somewhere saying 'no decimal numbers'?



if (state = 1) and
((ima(6,mode_ema,0) - ima(12,mode_ema,0) >= 25/100000) or
(ima(6,mode_ema,1) - ima(12,mode_ema,1) >= 25/100000) or
(ima(6,mode_ema,2) - ima(12,mode_ema,2) >= 25/100000) or
(ima(6,mode_ema,3) - ima(12,mode_ema,3) >= 25/100000))
then
state = 2 ;

2 I want value2 to be equal to an exponential moving average of the iMACD and value3 to be the difference between he two. How do I do that in MetaQuote III?

value1 = iMACD(12, 26, 9, mode_main, 0) ;
value2 =
value3 = (value1 - value2) ;

3. What does mode_main do for the iMACD?

4. In EasyLanguage the first parameter is the data type that will be used to figure the average; close, open, high and so on. What tells MetaQuote III what data to use to figure the average or the MACD, etc.

5. Can MetaQuote III programs be converted to MetaQuote IV programs or do they have to be completely re-written?


The program I'm trying to get to run on my DEMO is listed below. All the help I can get will be greatly appreciated. It does compile, but that's about as far as I've been able to get. I've enabled it on my DEMO, but it ain't do'n noth'n.

/*[[
Name := 15Min 5Day Buy System
Author := Copyright © 2005, MetaQuotes Software Corp.
Link := http://www.metaquotes.net/
Lots := 1.00
Stop Loss := 0
Take Profit := 0
Trailing Stop := 0
]]*/

variable: state(0) ;
variable: barcntr(0) ;
variable: value1(0) ;
variable: value2(0) ;
variable: value3(0) ;

value1 = iMACD(12,26,9,mode_main,0) ;
value2 = ima(value1, mode_ema, 0);
value3 = value1 - value2 ;

If barcntr > 0 and barcntr < 5
then
barcntr = barcntr + 1
else
begin
state = 0 ;
barcntr = 0 ;
end;

if (state = 0 or barcntr > 1) and
ima(6,mode_ema,0) > ima(12,mode_ema,0) and ima(6,mode_ema,1) < ima(12,mode_ema,1)
then
begin
state = 1 ;
barcntr = 1 ;
end ;

if (state = 1) and
((ima(6,mode_ema,0) - ima(12,mode_ema,0) >= 25/100000) or
(ima(6,mode_ema,1) - ima(12,mode_ema,1) >= 25/100000) or
(ima(6,mode_ema,2) - ima(12,mode_ema,2) >= 25/100000) or
(ima(6,mode_ema,3) - ima(12,mode_ema,3) >= 25/100000))
then
state = 2 ;

if (state = 2) and (barcntr < 5) and
((ima(6,mode_ema,0) - ima(6,mode_ema,3)) > 7/100000) and
(close > open) and (curtime not >= 400) and (curtime not <= 800) and
(ima(value1, mode_ema, 0) > ima(value1, mode_ema, 1))
then
begin
state = 3 ;
barcntr = 5 ;
end ;

if (state = 3) and ((close - open) <= 10/10000) or
(ima(6,mode_ema,0) > ima(12,mode_ema,0) and
ima(6,mode_ema,1) < ima(12,mode_ema,1))
then
begin
barcntr = 0 ;
state = 0 ;
setorder(OP_BUY,1,close,0,0,0,yellow) ;
alert() ;
end ;

if value1 <= value2
then
setorder(OP_SELL,1,close,0,0,0,blue) ;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-01-2005, 06:19 AM
igorad's Avatar
igorad igorad is offline
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 787
igorad is on a distinguished road
Hi,
I have some skills in EL, maybe you post EA for TS.
I have changed your code in MT3, perhaps it help.
For calculation MACD with other prices you could use iMACDex.
mode_main - main curve, signal_mode - signal curve.
In your EA don't describe trade exit rules

Corrected code:

defines: PerEMA(12);

variable: state(0) ;
variable: barcntr(0) ;
variable: value1(0) ;
variable: value2(0),value21(0) ;
variable: value3(0) ;

value1 = iMACD(12,26,9,mode_main,0);
value21= value2;
value2 = value21+2.0/(1.0+PerEMA)*(value1-value21);
value3 = value1 - value2 ;

If barcntr > 0 and barcntr < 5
then
barcntr = barcntr + 1
else
begin
state = 0 ;
barcntr = 0 ;
end;

if (state = 0 or barcntr > 1) and
ima(6,mode_ema,0) > ima(12,mode_ema,0) and ima(6,mode_ema,1) < ima(12,mode_ema,1)
then
begin
state = 1 ;
barcntr = 1 ;
end ;

if (state = 1) and
((ima(6,mode_ema,0) - ima(12,mode_ema,0) >= 25.0/10000.0) or
(ima(6,mode_ema,1) - ima(12,mode_ema,1) >= 25.0/10000.0) or
(ima(6,mode_ema,2) - ima(12,mode_ema,2) >= 25.0/10000.0) or
(ima(6,mode_ema,3) - ima(12,mode_ema,3) >= 25.0/10000.0))
then
state = 2 ;

if (state = 2) and (barcntr < 5) and
((ima(6,mode_ema,0) - ima(6,mode_ema,3)) > 7.0/10000.0) and
(close > open) and (curtime not >= 400) and (curtime not <= 800) and
(value2 > value21)
then
begin
state = 3 ;
barcntr = 5 ;
end ;

if (state = 3) and ((close - open) <= 10.0/10000.0) or
(ima(6,mode_ema,0) > ima(12,mode_ema,0) and
ima(6,mode_ema,1) < ima(12,mode_ema,1))
then
begin
barcntr = 0 ;
state = 0 ;
setorder(OP_BUY,1,close,0,0,0,yellow) ;
alert() ;
end ;

if value1 <= value2
then
setorder(OP_SELL,1,close,0,0,0,blue) ;


Chears,
Igor
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-01-2005, 02:58 PM
4xcash's Avatar
4xcash 4xcash is offline
Junior Member
 
Join Date: Nov 2005
Posts: 1
4xcash is on a distinguished road
Arrow easy language download

Where did you download easy language ?
can you send me link to :
easy[at]forexcash.cjb.net

Thanks.

Last edited by newdigital : 12-01-2005 at 03:03 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
translate easyLanguage in MT3 or MT4 gbolla Metatrader 3 32 07-10-2008 08:28 PM


All times are GMT. The time now is 09:28 AM.