查看: 1602|回复: 22
|
想请 EA 高手帮帮忙~~
[复制链接]
|
|
发表于 6-3-2009 07:07 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 6-3-2009 09:00 PM
|
显示全部楼层
原帖由 qplldb 于 6-3-2009 19:07 发表
M1喔,可能吗?
不是一次,是累积~~~ |
|
|
|
|
|
|
|
发表于 8-3-2009 11:12 PM
|
显示全部楼层
我看到forex-tsd裏面有,你去找找看 |
|
|
|
|
|
|
|
楼主 |
发表于 18-3-2009 08:17 PM
|
显示全部楼层
//+------------------------------------------------------------------+
//| matt.mq4 |
//| Copyright ?2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//---- input parameters
extern double Lot_Size=0.1;
extern double SAR_Step=0.03;
extern double SAR_Maximum=0.2;
//---global variables
int magic_number=19081846;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
int total_trade=OrdersTotal();
if (total_trade<=0)
{
PlaceTrades();
return(0);
}
int my_orders=0;
for (int i=0;i<total_trade;i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if ((OrderMagicNumber()==magic_number)&&(OrderSymbol()==Symbol()))
{
ManageTrades(OrderTicket(),OrderType(),OrderLots());
my_orders++;
}
}
if (my_orders==0) PlaceTrades();
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| ManageTrades function |
//+------------------------------------------------------------------+
int ManageTrades(int iticket, int itype, double dlots)
{
//----
RefreshRates();
//parabolic SAR calculations
double sar0=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,0);
double sar1=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,1);
//closing orders
if (iticket>=0)
{
if ((itype==OP_BUY)&&(High[0]<sar0)&&(High[1]<sar1))
OrderClose(iticket, dlots, Bid, 3, Black);
if ((itype==OP_SELL)&&(Low[0]>sar0)&&(Low[1]>sar1))
OrderClose(iticket, dlots, Ask, 3, Black);
}//end of closing orders
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| PlaceTrades function |
//+------------------------------------------------------------------+
void PlaceTrades()
{
//----
RefreshRates();
//parabolic SAR calculations
double sar0=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,0);
double sar1=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,1);
double sar2=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,2);
//trade direction
int trade_direction=0;
if ((High[2]<sar2)&&(Low[1]>sar1)&&(Low[0]>sar0)) trade_direction=1; //condition for long/buy trades
if ((Low[2]>sar2)&&(High[1]<sar1)&&(High[0]<sar0)) trade_direction=-1; //condition for short/sell trades
//place long trade
if (trade_direction==1)
OrderSend(Symbol(),OP_BUY, Lot_Size, Ask,3, 0, 0, "SAR Long Orders", magic_number, 0, Green);
//place short trade
if (trade_direction==-1)
OrderSend(Symbol(),OP_SELL, Lot_Size, Bid, 3, 0, 0, "SAR Short Orders", magic_number, 0, Red);
return;
}
//+------------------------------------------------------------------+
*请教我如何在这个 EA 加上 Targetprofit , Stoploss & Trailling stop!!!~~~~ |
|
|
|
|
|
|
|
发表于 20-3-2009 12:10 AM
|
显示全部楼层
奇怪。。。。我發不到長長的回帖
明天把EA code paste給你,我加了SL和TP |
|
|
|
|
|
|
|
发表于 20-3-2009 01:46 AM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 20-3-2009 09:53 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 21-3-2009 10:01 PM
|
显示全部楼层
//+------------------------------------------------------------------+
//| matt.mq4 |
//| Copyright ?2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//---- input parameters
extern double Lot_Size=0.1;
extern double SAR_Step=0.03;
extern double SAR_Maximum=0.2;
extern int TakeProfit =10;
extern int StopLoss =10;
//---global variables
int magic_number=19081846; |
|
|
|
|
|
|
|
发表于 21-3-2009 10:02 PM
|
显示全部楼层
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
} |
|
|
|
|
|
|
|
发表于 21-3-2009 10:03 PM
|
显示全部楼层
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
int total_trade=OrdersTotal();
if (total_trade<=0)
{
PlaceTrades();
return(0);
}
int my_orders=0;
for (int i=0;i<total_trade;i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if ((OrderMagicNumber()==magic_number)&&(OrderSymbol()==Symbol()))
{
ManageTrades(OrderTicket(),OrderType(),OrderLots());
my_orders++;
}
}
if (my_orders==0) PlaceTrades();
//----
return(0);
} |
|
|
|
|
|
|
|
发表于 21-3-2009 10:04 PM
|
显示全部楼层
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| ManageTrades function |
//+------------------------------------------------------------------+
int ManageTrades(int iticket, int itype, double dlots)
{
//----
RefreshRates();
//parabolic SAR calculations
double sar0=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,0);
double sar1=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,1);
//closing orders
if (iticket>=0)
{
if ((itype==OP_BUY)&&(High[0]<sar0)&&(High[1]<sar1))
OrderClose(iticket, dlots, Bid, 3, Black);
if ((itype==OP_SELL)&&(Low[0]>sar0)&&(Low[1]>sar1))
OrderClose(iticket, dlots, Ask, 3, Black);
}//end of closing orders
return(0); |
|
|
|
|
|
|
|
发表于 21-3-2009 10:04 PM
|
显示全部楼层
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| PlaceTrades function |
//+------------------------------------------------------------------+
void PlaceTrades()
{
//----
RefreshRates();
//parabolic SAR calculations
double sar0=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,0);
double sar1=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,1);
double sar2=iSAR(Symbol(),0,SAR_Step, SAR_Maximum,2); |
|
|
|
|
|
|
|
发表于 21-3-2009 10:05 PM
|
显示全部楼层
//trade direction
int trade_direction=0;
if ((High[2]<sar2)&&(Low[1]>sar1)&&(Low[0]>sar0)) trade_direction=1; //condition for long/buy trades
if ((Low[2]>sar2)&&(High[1]<sar1)&&(High[0]<sar0)) trade_direction=-1; //condition for short/sell trades
//place long trade
if (trade_direction==1)
OrderSend(Symbol(),OP_BUY, Lot_Size, Ask,3, Ask - (StopLoss * Point), Ask+TakeProfit*Point, "SAR Long Orders", magic_number, 0, Green);
//place short trade
if (trade_direction==-1)
OrderSend(Symbol(),OP_SELL, Lot_Size, Bid, 3, Bid + (StopLoss * Point), Bid-TakeProfit*Point, "SAR Short Orders", magic_number, 0, Red);
return;
}
//+------------------------------------------------------------------+ |
|
|
|
|
|
|
|
发表于 22-3-2009 02:43 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 22-3-2009 11:47 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 23-3-2009 12:18 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 31-3-2009 07:41 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 31-3-2009 07:55 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 6-4-2009 08:37 PM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|