Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


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 Thread Tools Display Modes
  #1 (permalink)  
Old 07-02-2007, 10:05 AM
Member
 
Join Date: Jan 2007
Posts: 43
3ammary is on a distinguished road
Smile smooth moving avarage crossover expert advisor

please i need
smooth moving avarage crossover expert advisor
many thanx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-02-2007, 11:12 AM
Senior Member
 
Join Date: Nov 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
LSMA Experts and Indicators
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-02-2007, 02:11 PM
Member
 
Join Date: Jan 2007
Posts: 43
3ammary is on a distinguished road
Cool thanx

many thanx
but i didn't find an ea that uses somthing cross of 2 moving average works in all time frames ,, thanx
any help?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-02-2007, 04:45 PM
Member
 
Join Date: Jan 2007
Posts: 43
3ammary is on a distinguished road
hi

could any one please convert this simple expert advisor cross over to ,, smoothed one
many thanx

//+------------------------------------------------------------------+
//| Rossman1.mq4 |
//| Rossman |
//| |
//+------------------------------------------------------------------+
#property copyright "Rossman"

//declare external variables to be used in start function
extern int MAperiodSlow=10;
extern int MAperiodFast=5;
extern int stopLoss=150;
extern int takeProfit=300;
extern double lots=1;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
//declare local variables to be used below

//total is used to make sure no order is placed if an order is open
//cnt stands for count and is used in the for loop that closes open orders
int total, cnt;

//maSlow and maFast are the 2 moving averages for the current bar in this EA
//maSlowPrevious and maFastPrevious are are the 2 moving averages for the
//previous bar. They are used to determine if the slow and fast moving averages have crossed
double maSlow,maSlowPrevious,maFast,maFastPrevious;

//I use simple moving average and the close price to calculate the moving average
maSlow = iMA(NULL,0,MAperiodSlow,0,MODE_SMA,PRICE_CLOSE,0);
maSlowPrevious = iMA(NULL,0,MAperiodSlow,0,MODE_SMA,PRICE_CLOSE,1);
maFast = iMA(NULL,0,MAperiodFast,0,MODE_SMA,PRICE_CLOSE,0);
maFastPrevious = iMA(NULL,0,MAperiodFast,0,MODE_SMA,PRICE_CLOSE,1);

//OrdersTotal() returns the number of open orders
total=OrdersTotal();

//for loop counts through the open orders. Order 1 is labeled 0 so we start with
//cnt=0 and end with cnt<total not cnt<=total and we count up through the orders with cnt++
for(cnt=0;cnt<total;cnt++)
{
//select the order from open trades by the position which is the value of cnt
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
//if the order is a buy order (ie long position)
if(OrderType() == OP_BUY)
{
//and if the fast moving average is less than the slow moving average
if(maFast<maSlow)
{
//close the selected order
OrderClose(OrderTicket(),OrderLots(),Bid,3,DarkGre en);
return(0);
}
}
//if not buy order, then it is a sell order (ie short position)
else
{
//and if the fast moving average is greater than the slow moving average
if(maFast>maSlow)
{
//close the selected order
OrderClose(OrderTicket(),OrderLots(),Ask,3,Maroon) ;
return(0);
}
}
return(0);
}
//if the total number of open orders is less than one (ie there aren't any)
if(total<1)
{
//and if the fast moving average is greater than the slow moving average and the fast moving average was less than
//the slow moving average one unit of time ago (this means the fast moving average has crossed up through the slow moving average)
if(maFast>maSlow && maFastPrevious<maSlowPrevious)
{
//make a buy order at the ask price for the number of lots in the external variable 'lots' with a stoploss equal to
//the external variable 'stopLoss' and a limit equal to the external variable 'take profit'
OrderSend(Symbol(),OP_BUY,lots,Ask,3,Ask-stopLoss*Point,Ask+takeProfit*Point,"Rossman1-buy",12055,0,Lime);
return(0);
}
//or if the fast moving average is less than the slow moving average and the fast moving average was greater than
//the slow moving average one unit of time ago (this means the fast moving average has crossed down through the slow moving average)
if(maFast<maSlow && maFastPrevious>maSlowPrevious)
{
//make a sell order at the bid price for the number of lots in the external variable 'lots' with a stoploss equal to
//the external variable 'stopLoss' and a limit equal to the external variable 'take profit'
OrderSend(Symbol(),OP_SELL,lots,Bid,3,Bid+stopLoss *Point,Bid-takeProfit*Point,"Rossman1-sell",12055,0,Red);
return(0);
}
return(0);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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 On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expert Advisor Moving Average Cross GBP/USD time frame H1 haba Expert Advisors - Metatrader 4 1 03-10-2007 12:55 PM
Request for custom crossover expert thn5625 Expert Advisors - Metatrader 4 2 01-26-2007 06:22 PM
50-34 Expert advisor geisebhum Suggestions for Trading Systems 4 12-20-2006 05:45 PM
CCI Expert Advisor rodrigokaus Expert Advisors - Metatrader 4 10 09-29-2006 06:31 PM


All times are GMT. The time now is 05:32 AM.



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