Forex



Go Back   Forex Trading > Discussion Areas > Metatrader 4 > Metatrader 3
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-01-2005, 12:46 AM
Junior Member
 
Join Date: Dec 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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 12-01-2005, 07:19 AM
igorad's Avatar
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 963
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 12-01-2005, 03:58 PM
4xcash's Avatar
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 04:03 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
mode_ema


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
translate easyLanguage in MT3 or MT4 gbolla Metatrader 4 37 11-07-2009 11:37 AM


All times are GMT. The time now is 10:33 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.