どんちゃんと聞いてぴーんと来た人もいらっしゃるかもしれません。
そうDONCHIAN CHANNEL ブレークスルーです。
//+------------------------------------------------------------------+
//| Donchian.mq4 |
//| TACA |
//+------------------------------------------------------------------+
#property strict
extern int Magic = 1;
extern double Lot = 0.1;
extern int Count=20;
extern ENUM_TIMEFRAMES TF=1;
int RV;
void OnTick()
{
double DonHigh = 0;
double DonLow = iHigh(Symbol(),TF,0)*2;
for(int i=Count;i>=1;i--)
{
if (DonHigh < iClose(Symbol(),TF,i)){DonHigh = iClose(Symbol(),TF,i);}
if (DonLow > iClose(Symbol(),TF,i)){DonLow = iClose(Symbol(),TF,i);}
}
if(!OrdersTotal())
{
if (DonHigh < Close[0]){RV=OrderSend(Symbol(),OP_BUY ,Lot,Ask,5,0,0,"DonChian",Magic);}
if (DonLow > Close[0]){RV=OrderSend(Symbol(),OP_SELL,Lot,Bid,5,0,0,"Donchian",Magic);}
}
else
{
RV=OrderSelect(0,SELECT_BY_POS);
if (DonHigh < Close[0] && OrderType() == OP_SELL ){RV=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3);}
if (DonLow > Close[0] && OrderType() == OP_BUY ){RV=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3);}
}
}
0 件のコメント:
コメントを投稿