//+------------------------------------------------------------------+ //| FT_CCI.mq4 | //| FORTRADER.RU, Юрий, ftyuriy@gmail.com | //| http://FORTRADER.RU, Фракталы + Средние | //+------------------------------------------------------------------+ #property copyright "FORTRADER.RU, Юрий, ftyuriy@gmail.com" #property link "http://FORTRADER.RU, CCI" /*Разработано для 50 выпуска журнала FORTRADER.Ru. Система по CCI. Отчеты: http://finfile.ru/index.php/files/get/4LvxA6u0UY/ft-cci-result2.zip Сет файлы:http://finfile.ru/index.php/files/get/Kz2LK5Gnj6/eurusdh1.set Обсуждение: http://fxnow.ru/group_discussion_view.php?group_id=49&grouptopic_id=409&grouppost_id=3439#post_3439 Архив журнала: http://www.fortrader.ru/arhiv.php 50 выпуск: http://www.fortrader.ru/ v0.3 - модификация для одинаковых тестов по контрольным точкам/ценам открытия/по тикам */ extern int cciper=14; extern int ccUPur=200; extern int ccDWur=-200; extern int maper=200; extern int tByuUr=-100; extern int tsellUr=100; extern int SL=0; extern int TP=0; extern int mn=1; int err; extern int MG=564651; extern double Lots=0.1; int bars; int start() { if(Bars!=bars && Bars>400) {bars=Bars; OpenPattern();//открываем сделки при мересечении } return(0); } int okbuy,oksell,okbuy1,oksell1; void OpenPattern() { double op,sl,tp; double ma=iMA(NULL,0,maper,0,MODE_SMA,PRICE_CLOSE,1); double CCICurr=iCCI(Symbol(),0,cciper,PRICE_TYPICAL,1); if(Close[1]>ma) if(CCICurrtByuUr && okbuy1==1 ) {okbuy1=0; if(timecontrol()==1) { op=Ask;if(SL>0){sl=Ask-SL*Point*mn;}if(TP>0){tp=Ask+TP*Point*mn;} err=OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits),"6 FORTRADER.RU",MG,0,Red); if(err<0){Print("OrderSend()- Ошибка OP_BUY. op "+op+" sl "+sl+" tp "+tp+" "+GetLastError());return(-1);} } CloseAllPos(0); } if(Close[1]ccDWur && okbuy==1 ) {okbuy=0; if(timecontrol()==1) { op=Ask;if(SL>0){sl=Ask-SL*Point*mn;}if(TP>0){tp=Ask+TP*Point*mn;} err=OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits),"6 FORTRADER.RU",MG,0,Red); if(err<0){Print("OrderSend()- Ошибка OP_BUY. op "+op+" sl "+sl+" tp "+tp+" "+GetLastError());return(-1);} } CloseAllPos(0); } if(Close[1]tsellUr) {oksell1=1;} if(CCICurr0){sl=Bid+SL*Point*mn;}if(TP>0){tp=Bid-TP*Point*mn;} err=OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits),"4 FORTRADER.RU",MG,0,Red); if(err<0){Print("OrderSend()- Ошибка OP_SELL. op "+op+" sl "+sl+" tp "+tp+" "+GetLastError());return(-1);} } CloseAllPos(1); } } if(Close[1]>ma) { if(CCICurr>ccUPur) {oksell=1;} if(CCICurr0){sl=Bid+SL*Point*mn;}if(TP>0){tp=Bid-TP*Point*mn;} err=OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(op,Digits),3,NormalizeDouble(sl,Digits),NormalizeDouble(tp,Digits),"4 FORTRADER.RU",MG,0,Red); if(err<0){Print("OrderSend()- Ошибка OP_SELL. op "+op+" sl "+sl+" tp "+tp+" "+GetLastError());return(-1);} } CloseAllPos(1); } } } //Закрываем все позиции по типу int CloseAllPos(int type) {//Описание функции: http://fxnow.ru/blog.php?user=Yuriy&blogentry_id=72 int buy=1; int sell=1; int i,b=0;int ordertiket; if(type==1) { while(buy==1) { buy=0; for( i=0;i=0 && Hour()<=stoptime-1) || (Hour()>=starttime && Hour()<=23)) && starttime>stoptime) { return(1); } if ( (Hour()>=starttime && Hour()<=stoptime-1) && starttime