day open

day open 最新版

官方版 无广告 82

更新日期:2022-03-02 分类标签: 语言:中文 平台:没限制

6 人已下载 手机查看

//+------------------------------------------------------------------+
//| day open.mq4 |
//| Copyright 2014, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
#property strict
extern double LOT=0.01;
extern int Profit=10;
int bars;
bool trade;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
trade=false;
bars=iBars(Symbol(),PERIOD_D1);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if (bars!=iBars(Symbol(),PERIOD_D1)){bars=iBars(Symbol(),PERIOD_D1);trade=true;}

if (trade){
OrderSend(Symbol(),OP_BUY,LOT,Ask,2,0,0,NULL,0123456,0,clrRed);
OrderSend(Symbol(),OP_SELL,LOT,Bid,2,0,0,NULL,0123456,0,clrRed);
trade=false;
}

int tot=OrdersTotal();

for(int i=0; i<=tot;i++)
{OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol()==Symbol() &&OrderMagicNumber()==0123456)
{
if(OrderType()==OP_BUY){if (Bid>= OrderOpenPrice()+Profit*Point)OrderClose(OrderTicket(),LOT,Bid,2,clrAqua);}

if(OrderType()==OP_SELL){if (Ask<= OrderOpenPrice()-Profit*Point)OrderClose(OrderTicket(),LOT,Ask,2,clrAqua);}
}

}

}
//+------------------------------------------------------------------+

相关资源

暂无评论

暂无评论...