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
05-18-2006, 03:49 PM
Member
Join Date: Feb 2006
Location: Bandung,Indonesia
Posts: 83
there's anyone here?,..i really need help to add the code, please....
05-19-2006, 06:36 AM
Senior Member
Join Date: May 2006
Posts: 319
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 ^_^
05-19-2006, 11:39 AM
Member
Join Date: Feb 2006
Location: Bandung,Indonesia
Posts: 83
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...
05-19-2006, 02:33 PM
Senior Member
Join Date: May 2006
Posts: 319
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 .
05-22-2006, 05:02 AM
Senior Member
Join Date: May 2006
Posts: 319
Here Is An Example , But You Need To Add Your Trade Condition Yourself ^_^
05-22-2006, 01:06 PM
Member
Join Date: Feb 2006
Location: Bandung,Indonesia
Posts: 83
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
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT. The time now is 09:51 AM .