20160321-30分钟智能测试交易系统-改进

思想:做30分钟K线的美元/日元货币对,遇大阴线做空,遇大阳线做空,只做后边一根K线。

问题分析:胜率很低

代码:

extern double Lots = 0.1;
extern string Currency = "USDJPYpro";
int opentime = 59;
int start()
{

if (TimeMinute(TimeCurrent()) > opentime)
{
int total=OrdersTotal();
int cnt;
for(cnt=total-1;cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_SELL)
{
bool test1=OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE);
}
if(OrderType()==OP_BUY)
{
bool test2=OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);
}
}
if (test1 == 1 || test2 ==1) opentime=59;
}
double HIGH = iHigh("USDJPYpro", PERIOD_M5, 1);
double LOW = iLow("USDJPYpro", PERIOD_M5, 1);
double CLOSE = iClose("USDJPYpro", PERIOD_M5, 1);
double OPEN = iOpen("USDJPYpro", PERIOD_M5, 1);
double gaodu = MathAbs(CLOSE - OPEN);
double chajia = MathAbs(HIGH - LOW);

if (gaodu > 0.045 && chajia >0.04 && OrdersTotal()==0)
{
if (CLOSE>OPEN && MarketInfo(Currency,MODE_BID)>HIGH && TimeMinute(TimeCurrent())!=59)
{
OrderSend(Currency,OP_BUY,Lots,Ask,3,CLOSE-0.015,0,NULL,0,0,Red);
opentime = TimeMinute(TimeCurrent());
}

else if (CLOSE<OPEN && MarketInfo(Currency,MODE_BID)<LOW && TimeMinute(TimeCurrent())!=59)
{
OrderSend(Currency,OP_SELL,Lots,Bid,3,CLOSE+0.015,0,NULL,0,0,Red);
opentime = TimeMinute(TimeCurrent());
}

}

}