Нейросетевая торговая система Meta Trader 4 + MATLAB. Пошаговая разработка. Издание второе
Шрифт:
{
bool close1=OrderClose(TicketBuy1,1,Bid,2,Blue);
}
//–Sell0
if(MagicSell0==0 && K>0 && Buf_0[K-1]>Buf_1[K-1] && Buf_0[K]<Buf_1[K] && TimeHour(TimeCurrent)>H3 && TimeHour(TimeCurrent)<H4 && H3<H4)
{
bool send0=OrderSend(Symbol,OP_SELL,1,Bid,3,Ask+Loss0*Point,Bid-Profit0*Point,NULL,3,0,Green);
for( i=1; i<=OrdersTotal; i++)
{
if(OrderSelect(i-1,SELECT_BY_POS)==true)
{
TicketSell0=OrderTicket;
MagicSell0=OrderMagicNumber;
}
}
}
if(MagicSell0==3 && K>0 && Buf_0[K-1]<Buf_1[K-1] && Buf_0[K]>Buf_1[K])
{
bool close0=OrderClose(TicketSell0,1,Ask,2,Blue);
}
K++;
}
//+–+
Выше
//–Buy0
if(MagicBuy1==0 && K>0 && Buf_0[K-1]<Buf_1[K-1] && Buf_0[K]>Buf_1[K] && TimeHour(TimeCurrent)>H1 && TimeHour(TimeCurrent)<H2 && H1<H2)
{
bool send1=OrderSend(Symbol,OP_BUY,1,Ask,3,0,0,NULL,1,0,Red);
for( i=1; i<=OrdersTotal; i++)
{
if(OrderSelect(i-1,SELECT_BY_POS)==true)
{
TicketBuy1=OrderTicket;
MagicBuy1=OrderMagicNumber;
}
}
}
if(MagicBuy1==1 && K>0 && Buf_0[K-1]>Buf_1[K-1] && Buf_0[K]<Buf_1[K] )
{
bool close1=OrderClose(TicketBuy1,1,Bid,2,Blue);
}
//–Sell0
if(MagicSell0==0 && K>0 && Buf_0[K-1]>Buf_1[K-1] && Buf_0[K]<Buf_1[K] && TimeHour(TimeCurrent)>H3 && TimeHour(TimeCurrent)<H4 && H3<H4)
{
bool send0=OrderSend(Symbol,OP_SELL,1,Bid,3,0,0,NULL,3,0,Green);
for( i=1; i<=OrdersTotal; i++)
{
if(OrderSelect(i-1,SELECT_BY_POS)==true)
{
TicketSell0=OrderTicket;
MagicSell0=OrderMagicNumber;
}
}
}
if(MagicSell0==3 && K>0 && Buf_0[K-1]<Buf_1[K-1] && Buf_0[K]>Buf_1[K] )
{
bool close0=OrderClose(TicketSell0,1,Ask,2,Blue);
Конец ознакомительного фрагмента.