Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
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 10-11-2006, 03:45 PM
Member
 
Join Date: Oct 2006
Posts: 59
Jovager is on a distinguished road
My first EA

Thanks to Eaglehawk for his help.

For a first EA, I have tried to begin very simple.

Buy if last bar close is higher than previous close.No sell, no Takeprofit, no stoploss and no trailing stop, thinking I will see the backtest chart full with buys, but nothing.

The EA was compiled without mistakes, and I have not any message of error.

What is wrong.

Thanks for help.

extern double MaxOpenTrade=4;
extern double Lots = 0.1;
extern double TakeProfit=25;


int start()
{
double CloseCurrent,ClosePrevious;
int total,ticket;

if(Bars<100)
{
Print("Moins de 100 bougies !");
return(0);
}
CloseCurrent= iClose(NULL,PERIOD_M15,0);
ClosePrevious=iClose(NULL,PERIOD_M15,1);
{
total=OrdersTotal();


if(OrdersTotal()<MaxOpenTrade)
{

if(AccountFreeMargin()<(1000*Lots))
{
Print("Il n y a pas suffisamment d argent. La marge disponible est ", AccountFreeMargin());
return(0);
}

if(CloseCurrent> ClosePrevious)


ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+ TakeProfit*Point,"Example Achat ",16384,0,Green);


if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) Print("Ordre d ACHAT exécuté à : ",OrderOpenPrice());
}

else Print("Erreur à la création de l ordre ACHAT : ",GetLastError());
return(0);

return(0);
}
}}
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 10-11-2006, 04:20 PM
Member
 
Join Date: Oct 2006
Posts: 59
Jovager is on a distinguished road
Add to my precedent post

The EA doesn't run on backtest but it runs on demo live, always for only 1 trade.

What can I change ?
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 10-21-2006, 07:05 AM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
first off, i don't trust the strategy tester in metatrader 4 for several reason that are still all over this forem and have been for the past month.

secondly, if you want this ea to run in the bactester, maybe you should see what the problem exacly is. there is a tab in the tester titled "journal" click here and see what it says. some problems may be the testers money issue. if you use too big of lot sizes, it'll say "no money availiable" or if it doesn't and the problem is the same, it'll run when you put in bigger starting balances, and not when you use smaller ones.
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER,
"Genius is nothing but a greater aptitude for patience." –Benjamin Franklin

____________________________________

Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!!

http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
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


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


All times are GMT. The time now is 10:14 AM.



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