Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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 (2) Thread Tools Display Modes
  #571 (permalink)  
Old 04-26-2007, 04:06 AM
Raft's Avatar
Junior Member
 
Join Date: Apr 2007
Location: La Quinta, CA USA
Posts: 4
Raft is on a distinguished road
Getting Started

I'm writing my first EA from nearly scratch after successfully making a few mods to an EA found on the web. I'm puzzled by an error statement I get when I run the code through the compiler.

The code is:

//=====================================

int start()

if(OrdersTotal()<1) {
OrderSend(Symbol(),OP_BUY,Lotsi,Ask,slippage,-25*Point,25*Point,0,0,0,Blue);
Clotsi = Lotsi;
return(0);
}

//=====================================

The error message is:

"if" - semicolon expected


//=====================================

I have tried placing a semicolon at several different locations but get the same message. At this point in time I have only one "if" statement in the EA --- more will follow if I get past this point.

I'm it must be something simple, but I can't figure it out from the examples in the manual another info I have found thus far.

Any help you can offer is appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #572 (permalink)  
Old 04-26-2007, 05:52 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
maybe an opening brace, "{", after "start()" ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #573 (permalink)  
Old 04-26-2007, 07:04 AM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 696
Kalenzo is on a distinguished road
Quote:
Originally Posted by Raft
I'm writing my first EA from nearly scratch after successfully making a few mods to an EA found on the web. I'm puzzled by an error statement I get when I run the code through the compiler.

The code is:

//=====================================

int start()

if(OrdersTotal()<1) {
OrderSend(Symbol(),OP_BUY,Lotsi,Ask,slippage,-25*Point,25*Point,0,0,0,Blue);
Clotsi = Lotsi;
return(0);
}

//=====================================

The error message is:

"if" - semicolon expected


//=====================================

I have tried placing a semicolon at several different locations but get the same message. At this point in time I have only one "if" statement in the EA --- more will follow if I get past this point.

I'm it must be something simple, but I can't figure it out from the examples in the manual another info I have found thus far.

Any help you can offer is appreciated.
Post your whole code here, so we can read it and point you the place to put semicolon.
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #574 (permalink)  
Old 04-26-2007, 01:27 PM
Raft's Avatar
Junior Member
 
Join Date: Apr 2007
Location: La Quinta, CA USA
Posts: 4
Raft is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist
maybe an opening brace, "{", after "start()" ?

Thanks, ralph.

The opening brace solved the problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #575 (permalink)  
Old 04-27-2007, 03:44 AM
Junior Member
 
Join Date: Jul 2006
Posts: 4
forexer is on a distinguished road
T3 TRIX of MA

I need modification of indicator T3 TRIX to read the value from indicator Moving Averages (iMA). I very expecting for your help
Attached Files
File Type: mq4 #MTF_MovingAverage.mq4 (4.4 KB, 11 views)
File Type: mq4 T3 TRIX.mq4 (4.4 KB, 15 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #576 (permalink)  
Old 04-27-2007, 07:33 PM
Raft's Avatar
Junior Member
 
Join Date: Apr 2007
Location: La Quinta, CA USA
Posts: 4
Raft is on a distinguished road
EA is complete but does not run

Ralph & Kalenzo, thanks for your reponse a couple days ago.

I have completed the EA and it clears the compiler with no errors and loads successfully in the stategy tester, but does not produce any results. Any thoughts?

Here is the entire code, but first let me say I have no illusions as whether this EA can produce a profit. I am simply trying to write an EA start to finish get it to run. This EA is a modified version of the Blessing strategy with a d'Alembert money managemenet system instead of the Martingale MM.


extern int Rungsi = 20;
extern int slippage = 5;
extern double Lotsi = 0.1;
extern int stoploss = 25;
extern int takeprofit = 25;
extern string Note1 = "Valid TimeFrames: 1, 5, 15, 30, 60, 240, 1440, 10080, 43200";
int Wcnt = 0;
int Lcnt = 0;
int cnt = 0;
double Clotsi = 0;
double Lucnt = 0;
bool EnableTrading = true;
double PipValue = 0;
string text2 = "";
string text = "";


//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

int init()
{
return(0);
}

//+------------------------------------------------------------------+

int deinit()
{
return(0);
}

//+------------------------------------------------------------------+

int start()
{
if(OrdersTotal()<1){
OrderSend(Symbol(),OP_BUY,Lotsi,Ask,slippage,stopl oss,takeprofit,0,0,0,Blue);
Clotsi = Lotsi;
return(0);
}
else
OrderSelect(1,SELECT_BY_POS,MODE_TRADES);
if(Bid >= OrderOpenPrice()+Rungsi*Point){
OrderClose(1,Clotsi,Bid,slippage,Blue);
if(Lcnt==0){
OrderSend(Symbol(),OP_BUY,Lotsi,Ask,slippage,stopl oss,takeprofit,0,0,0,Blue);
return(0);
}
else
Wcnt=Wcnt+1;
if(Wcnt==1){
Clotsi=Lcnt;
OrderSend(Symbol(),OP_BUY,Clotsi,Ask,slippage,stop loss,takeprofit,0,0,0,Blue);
Lucnt=0;
return(0);
}
else
Lcnt=0;
Wcnt=0;
OrderSend(Symbol(),OP_BUY,Lotsi,Ask,slippage,stopl oss,takeprofit,0,0,0,Blue);
return(0);
}
else
if(Bid <= OrderOpenPrice()-Rungsi*Point){
OrderClose(1,Clotsi,Bid,slippage,Blue);
Lucnt=Lucnt+Clotsi;
Lcnt=Lcnt+1;
OrderSend(Symbol(),OP_BUY,Clotsi,Ask,slippage,stop loss,takeprofit,0,0,0,Blue);
return(0);
}
else
return(0);
}
Attached Files
File Type: mq4 DAlembert_Ladder_Build_01.mq4 (2.2 KB, 14 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #577 (permalink)  
Old 04-28-2007, 03:18 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
The stoploss and takeprofit parameters to OrderSend are "price values" and not pips. Try using "Ask-stoploss*Point" and "Ask+takeprofit*Point" instead; when it comes to EA writing, not only the trend is your friend, but so is the manual ;-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #578 (permalink)  
Old 04-29-2007, 03:46 AM
Raft's Avatar
Junior Member
 
Join Date: Apr 2007
Location: La Quinta, CA USA
Posts: 4
Raft is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist
The stoploss and takeprofit parameters to OrderSend are "price values" and not pips. Try using "Ask-stoploss*Point" and "Ask+takeprofit*Point" instead; when it comes to EA writing, not only the trend is your friend, but so is the manual ;-)

Ralph,

Thank you very much for your patient and polite responses. I know the mistakes were really dumb ones. As a beginner I didn't know where to begin when the EA passed muster with compiler, and the Strategy Tester said it loaded successfully, but would not produce any results.

Prior to posting my request I had actually tried something close (but obviously not correct) to what is in the manual. That earlier version passed muster with the compiler, but the Stategy Tester rejected the OrderSend syntax. So I looked at the OrderSend statement in the EA that I had made some mods to, to see its syntax. That's where I derived the bad syntax. What I now understand is the author of that EA prefined "stoploss" and "takeprofit" using the correct syntax before the OrderSend statement is executed.

Have some programming experience with Fortran and Basic, but the MQL4 language is challenging for me right now.

Thanks again for your succint and polite responses. They were most helpful.

Raft

BTY Now that the EA runs I can see I have a couple logic errors in the EA as well, but I'll figure those out now that I have the syntax issues behind me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #579 (permalink)  
Old 04-30-2007, 05:49 PM
Junior Member
 
Join Date: Dec 2006
Posts: 2
toppz is on a distinguished road
need help with EA coversion

hi everyone,
thumbs up to you guy for having a heart to help. i am trying to convert a straddle ea to script can anyone give me an idea how to go abt it?
thanks in advance
__________________
it's all abt the news
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #580 (permalink)  
Old 04-30-2007, 06:25 PM
Senior Member
 
Join Date: Nov 2006
Posts: 231
teldon is on a distinguished road
some kind of script that monitors the trades until it reaches a preset profit so that as soon as the trades starts coming down after exceeding the preset profit it must close all trades on that currency. But if the profit goes up beyond the preset , it should trail the preset amount not individual trade.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
histogram, forex

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 09:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 11:46 AM


All times are GMT. The time now is 01:38 PM.



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