View Single Post
  #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) ;
Reply With Quote