代码拉取完成,页面将自动刷新
extern int mm = 1; //资金
extern int reinv = 0.1; //
extern int maxLots = 20; //最大手数
extern double Lots = 0.1 ; //资金控制,控制下单手数
extern int 获利 = 20 ; //止盈
extern int 滑点偏移数 = 3 ; //滑点
extern double 移动止损 = 305; //跟踪止赢点数设置
extern int 下单周期 = PERIOD_M15; //周期
extern double 止损 = 305; //止损
extern double 跟踪止损 = 5;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int MA1=iCustom(Symbol(),下单周期,"MA",15,3,34,1,180,1,0,1);
int MA2=iCustom(Symbol(),下单周期,"MA",15,3,34,1,180,1,1,1);
int MA4=iCustom(Symbol(),下单周期,"MA",15,3,34,1,180,1,3,1);
int MA5=iCustom(Symbol(),下单周期,"MA",15,3,34,1,180,1,4,1);
int MA6=iCustom(Symbol(),下单周期,"MA",15,3,34,1,180,1,5,1);
int MA7=iCustom(Symbol(),下单周期,"MA",15,3,34,1,180,1,6,1);
int total=OrdersTotal();
for(int cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol()) // check for symbol
{
if(OrderType()==OP_BUY) // long position is opened
{
// should it be closed?
// check for trailing stop
if(跟踪止损>0)
{
if (OrderStopLoss() == 0.0)
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*移动止损,OrderTakeProfit(),0,Green);
if(Bid-OrderOpenPrice()>Point*跟踪止损){
if(Bid-OrderStopLoss()>Point*跟踪止损)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*跟踪止损,OrderTakeProfit(),0,Green);
}
}}
}
else // go to short position
{
// should it be closed?
// check for trailing stop
if(跟踪止损>0)
{
if (OrderStopLoss() == 0.0)
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*移动止损,OrderTakeProfit(),0,Red);
if((OrderOpenPrice()-Ask)>(Point*跟踪止损)){
if((OrderStopLoss()-Ask)>(Point*跟踪止损))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*跟踪止损,OrderTakeProfit(),0,Red);
}
}}
}
}
}
int Ticket;
int Total = OrdersTotal(); //返回订单总数
if (Total<=0)
{
if (mm == 1) {
if (Lots < MathCeil(AccountFreeMargin() / 1000.0 * reinv) / 10.0) {
Lots = MathCeil(AccountFreeMargin() / 1000.0 * reinv) / 10.0;
if (Lots > maxLots) Lots = maxLots;
}
}
if (MA1==1 && MA4==1 && MA6==1 && Hour()==1)
{
Print("MA4",+MA4);
Ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,滑点偏移数,Ask-止损*Point,Ask+获利*Point,"",100,0,0);
if(Ticket>0)
{
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES))
Print("买入成功:",OrderOpenPrice());
}
else Print("错误,买入不成功,原因是:",GetLastError());
}
if( MA2==1 && MA5==1 && MA7==1 && Hour()==1)
{
Print("MA5",+MA5);
Ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,滑点偏移数,Bid+止损*Point,Bid-获利*Point,"",200,0,0);
if(Ticket>0)
{
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("卖出成功:",OrderOpenPrice());
}
else Print("错误,卖出不成功,原因是:",GetLastError());
}
//----------------------------------------------------------------------------------------------------------------------------+
}
//+---------------------------------------------------------------------------------------------------------------------------+
return(0);
}
//+----------------------------------------------------------------------------------------------------------------------------+
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。