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
  #521 (permalink)  
Old 03-02-2007, 04:46 AM
Junior Member
 
Join Date: Oct 2006
Posts: 8
Greentooth is on a distinguished road
EA not working on forward testing

Dear Codersguru,
Could you please help look into my EA below. Its work perfectly fine in backtesting but not on live demo trading account. They is no buy or sell action at all after the crosses. Thank you very much.




//+------------------------------------------------------------------+
//| 5/13-v2-SOS.mq4 |
//+------------------------------------------------------------------+
extern int Unique_Ref_Number=513;
extern int TakeProfit = 5;
extern int StopLoss=5;
extern double Lots = 1;
extern int Max_Contracts = 1;
extern int emaShortPeriod=5;
extern int emaLongPeriod=13;
extern bool MoneyManagement=true;
extern int Risk=2;

int init() { return(0); }
int deinit() { return(0); }


int Crossed()
{


double emaLong_1=iMA(NULL,0,emaLongPeriod,0,1,PRICE_CLOSE ,2);
double emaLong=iMA(NULL,0,emaLongPeriod,0,1,PRICE_CLOSE,1 );
double emaShort_1=iMA(NULL,0,emaShortPeriod,0,1,PRICE_CLO SE,2);
double emaShort=iMA(NULL,0,emaShortPeriod,0,1,PRICE_CLOSE ,1);

if (emaShort_1<emaLong_1 && emaShort>emaLong ) return (1); //up trend
if (emaShort_1>emaLong_1 && emaShort<emaLong ) return (2); //down trend

return (0); //no action
}


int start()
{
double BuyStopLoss, SellStopLoss, Lotsize ;
int cnt, ticket;
static datetime ordertime;
int total=OrdersTotal();

if(MoneyManagement==true)
{Lotsize=NormalizeDouble((AccountFreeMargin()*Risk/10000),1);}
else
{ Lotsize=Lots; }


BuyStopLoss=MathMin(MathMin(MathMin(Low[1],Low[2]),Low[3]),Ask-StopLoss*Point);
SellStopLoss=MathMax(MathMax(MathMax(High[1],High[2]),High[3]),Bid+StopLoss*Point);



if(Time[0]>ordertime && total<Max_Contracts)

{
// check for long position (BUY) possibility
if(Crossed()==1 )
{
OrderSend(Symbol(),OP_BUY,Lotsize,Ask,1,BuyStopLos s,Ask+TakeProfit*Point,"5-13-Long",Unique_Ref_Number,0,Green);
ordertime=Time[0];
return(0);
}
// check for short position (SELL) possibility
if(Crossed()==2 )
{
OrderSend(Symbol(),OP_SELL,Lotsize,Bid,1,SellStopL oss,Bid-TakeProfit*Point,"5-13-Short",Unique_Ref_Number,0,Red);
ordertime=Time[0];
return(0);
}

}

return(0);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #522 (permalink)  
Old 03-03-2007, 05:58 PM
Junior Member
 
Join Date: Apr 2006
Posts: 16
compro99 is on a distinguished road
Codersguru,

I need yr help for a MT4 EA.

Day start at 0000 GMT.

1) Draw 5 horizontal lines (different colors). Yesterday OHLC and yesterday (H+L)/2 median line.

2) Sound and pop up alerts when price touches any of the 5 lines.

It would be great if u could help. Thanks...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #523 (permalink)  
Old 03-14-2007, 03:03 PM
MiniMe's Avatar
Senior Member
 
Join Date: Nov 2006
Location: Montréal
Posts: 1,185
MiniMe is on a distinguished road
Unhappy Line thick Control - Help pls

the indicator is for drawing trend line
all I want is to be able to change the thinkness of the trend line

Help pls
Alan
Attached Files
File Type: mq4 ang_AutoCh_HL-v2.mq4 (5.3 KB, 18 views)
File Type: mq4 ang_AutoCh_HL-v1.mq4 (5.3 KB, 16 views)
__________________
Risk comes from not knowing what you're doing
Never argue with an idiot. They drag you down to their level then beat you with experience
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #524 (permalink)  
Old 03-14-2007, 03:14 PM
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
Quote:
Originally Posted by MiniMe
the indicator is for drawing trend line
all I want is to be able to change the thinkness of the trend line

Help pls
Alan

Here it is. Hope this is what you wanted.
Attached Files
File Type: mq4 ang_AutoCh_HL-v2.mq4 (5.4 KB, 33 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #525 (permalink)  
Old 03-14-2007, 04:05 PM
MiniMe's Avatar
Senior Member
 
Join Date: Nov 2006
Location: Montréal
Posts: 1,185
MiniMe is on a distinguished road
Quote:
Originally Posted by Maji
Here it is. Hope this is what you wanted.
Thanks a lot Maji, exactly what I was looking for
__________________
Risk comes from not knowing what you're doing
Never argue with an idiot. They drag you down to their level then beat you with experience
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #526 (permalink)  
Old 03-16-2007, 06:33 AM
Member
 
Join Date: Oct 2006
Posts: 56
Jovager is on a distinguished road
Alarm

How write an alarm for having it only 1 time and not again and again ?

Thanks for help.

Jo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #527 (permalink)  
Old 03-16-2007, 08:37 AM
Administrator
 
Join Date: Sep 2005
Posts: 16,311
Blog Entries: 106
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Many functions are here http://www.forex-tsd.com/general-dis...ing-forum.html

And alert_once thread is here Alert Once (Brain Damage)!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #528 (permalink)  
Old 03-21-2007, 01:18 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 400
iscuba11 is on a distinguished road
Question Please check this statement - Need confirmation Please!

PHP Code:
iLow(NULL,0,Lowest(NULL,0,MODE_LOW,1,4)<=0
Does this say that the Lowest of my indicator (4 bars back) should be less than or equal 0?? If not, how should it be stated?

Dave

Thanks in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #529 (permalink)  
Old 03-21-2007, 02:01 PM
Member
 
Join Date: Dec 2005
Posts: 68
asmdev is on a distinguished road
Quote:
Originally Posted by iscuba11
PHP Code:
iLow(NULL,0,Lowest(NULL,0,MODE_LOW,1,4)<=0
Does this say that the Lowest of my indicator (4 bars back) should be less than or equal 0?? If not, how should it be stated?

Dave

Thanks in advance!
that's not right, you can look post 516 on page 52
the way you calculate lowest of indicator is not correct

Last edited by asmdev; 03-21-2007 at 02:29 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #530 (permalink)  
Old 03-21-2007, 03:44 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 400
iscuba11 is on a distinguished road
Question

Quote:
Originally Posted by asmdev
that's not right, you can look post 516 on page 52
the way you calculate lowest of indicator is not correct

PHP Code:
double lowestFG=9999highestFG=-9999;//FG short for Forex_Grail, the name of my indicator histogram file.
int currentBar=0;
int endBar=4;
for(
currentBar=0;currentBar<endBarcurrentBar++)
lowestFG=MathMin(lowestFGiForex_Grail(Symbol(),0,17,PRICE_CLOSE,currentBar)); //0 = anytime, 17 = maperiod of indicator.

if lowestFG <= 0 then go to next statement 

Does this read right??

Dave

When I put this into my EA program, it says the iForex_Grail - function is not defined?? Forex_Grail is the name of my custom indicator.


Maybe it is to be stated: lowestFG=MathMin(lowestFG, iCustom(NULL,0,"Forex-Grail Trade Indicator",period,PRICE_CLOSE,currentBar)); ??

Last edited by iscuba11; 03-21-2007 at 04:59 PM.
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 07:59 PM.



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