Go Back   Forex-TSD > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent 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
  #11 (permalink)  
Old 05-18-2006, 03:49 PM
harryhid's Avatar
Member
 
Join Date: Feb 2006
Location: Bandung,Indonesia
Posts: 83
harryhid is on a distinguished road
there's anyone here?,..i really need help to add the code, please....
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
  #12 (permalink)  
Old 05-19-2006, 06:36 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 319
phoenix is on a distinguished road
try this...
//-------------------------------
for(cnt=0;cnt<HistoryTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY);

if(OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNo)
{
int lastclosetime = OrderCloseTime();
if(lastclosetime>iTime(Symbol(),wrkPeriod,0))
{
tradeenable=false;
}
else
{
tradeenable=true;
}
}
}
//-------------------------------

may help ^_^
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
  #13 (permalink)  
Old 05-19-2006, 11:39 AM
harryhid's Avatar
Member
 
Join Date: Feb 2006
Location: Bandung,Indonesia
Posts: 83
harryhid is on a distinguished road
Quote:
Originally Posted by phoenix
try this...
//-------------------------------
for(cnt=0;cnt<HistoryTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY);

if(OrderSymbol()==Symbol()&& OrderMagicNumber()==MagicNo)
{
int lastclosetime = OrderCloseTime();
if(lastclosetime>iTime(Symbol(),wrkPeriod,0))
{
tradeenable=false;
}
else
{
tradeenable=true;
}
}
}
//-------------------------------

may help ^_^
Can you add the code directly to the EA, Please?... I almost don't know anything about writing the code. I create this EA with EA builder from a web. Only a few that i know about MQL, that's why i'm asking you bro...if don't mind, please...
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
  #14 (permalink)  
Old 05-19-2006, 02:33 PM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 319
phoenix is on a distinguished road
after the code above ,


//------------------------------
if(CalculateCurrentOrders(Symbol())==0)<<--check the opening order
{
if(tradeenable)<<--allow to trade
{
if(your Buy condition)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,spread,A sk-SLlevel*Point,Ask+TakeProfit*Point,your Order Comment,MagicNo,0,OpenBuy_Sig_Color);
}
if(your sell condition)
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,spread, Bid+SLlevel*Point,Bid-TakeProfit*Point,your Order Comment,MagicNo,0,OpenBuy_Sig_Color);
}
}
else ticket=-1;

if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES ))
{
Print("Order opened : ",OrderOpenPrice());
return(0);
}//end OrderSelect
return(0);
}//end ticket>0
return(0);
}//end of CalculateCurrentOrders()

//------------------------------
total = OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY) // long position is opening
{

if(your close buy condition)
{
OrderClose(OrderTicket(),OrderLots(),Bid,spread,CloseBuy_Sig_Color);
// close position

return(0); // exit
}//end close buy

// check for trailing stop
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Modified_Sig_Color);

return(0);
}//end OrderStopLoss()<Bid-Point*TrailingStop
}//end Bid-OrderOpenPrice()>Point*TrailingStop
}//end TrailingStop>0
}//end OrderType()==OP_BUY

else // go to short position
{


if(your close sell condition)
{
// should it be closed?
OrderClose(OrderTicket(),OrderLots(),Ask,spread,CloseSell_Sig_Color);
// close position

return(0); // exit
}//end closesell

// check for trailing stop
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Modified_Sig_Color);

return(0);
}//end OrderStopLoss()
}//end OrderOpenPrice()-Ask >(Point*TrailingStop)
}//end TrailingStop>0
}//end else
}//end OrderType()<=OP_SELL && OrderSymbol()==Symbol()
}//end for
//-------------------------------------

hope this help ^_^

Last edited by phoenix; 05-19-2006 at 02:35 PM.
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
  #15 (permalink)  
Old 05-22-2006, 05:02 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 319
phoenix is on a distinguished road
Here Is An Example , But You Need To Add Your Trade Condition Yourself ^_^
Attached Files
File Type: mq4 BarByBar.mq4 (10.6 KB, 85 views)
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
  #16 (permalink)  
Old 05-22-2006, 01:06 PM
harryhid's Avatar
Member
 
Join Date: Feb 2006
Location: Bandung,Indonesia
Posts: 83
harryhid is on a distinguished road
Quote:
Originally Posted by phoenix
Here Is An Example , But You Need To Add Your Trade Condition Yourself ^_^
Thank's very much,..it's work. now i'm ready going to test run my strategy
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to send email alerts when closed trades... Nicholishen Metatrader 4 7 06-12-2009 06:00 AM
mt4 broker closed my orders?? jackjones General Discussion 2 05-23-2007 02:32 PM


All times are GMT. The time now is 09:51 AM.



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