시스템트레이딩 게시글

다중 통화 야간 스캘퍼: 메타트레이더 5를 위한 EA

첨부파일
16350.zip (1.72 KB, 다운로드 0회)

다중 통화 야간 스캘퍼는 메타트레이더 5에서 사용할 수 있는 EA로, 자정까지 좁은 범위 내에서 거래를 진행합니다. 이때 볼린저 밴드 지표를 사용하여 범위를 결정합니다.

BBHandle=iBands(symb,0,per,0,dev,0);
   CopyBuffer(BBHandle,1,0,1,up);
   CopyBuffer(BBHandle,2,0,1,dn);

   double r=up[0]-dn[0];

지정된 시작 시간이 지나고, 해당 심볼에 열린 포지션이 없을 경우 포지션을 엽니다.

if(CountTrades(symb)<1 && TimeCurrent()>StringToTime(s))

가격이 볼린저 밴드의 하한선보다 낮고, 채널이 Razmah 변수에서 지정한 범위보다 작으면 매수합니다.

if(Ask<dn[0] && r<razmah*_Point) trade.PositionOpen(symb,0,Lot,Ask,Ask-stop*_Point,Ask+take*_Point);

가격이 볼린저 밴드의 상한선보다 높고, 채널이 Razmah 변수에서 지정한 범위보다 작으면 매도합니다.

if(Bid>up[0] && r<razmah*_Point) trade.PositionOpen(symb,1,Lot,Bid,Bid+stop*_Point,Bid-take*_Point);

포지션은 손실 제한 또는 자정 이후 강제로 종료됩니다.

else if(CountTrades(symb)>0 && TimeCurrent()<StringToTime(s)) CloseAll(symb);

거래는 SymbolTrade 함수를 통해 수행되며 СTrade 클래스를 사용합니다:

void SymbolTrade(string symb,int stop,int take,int per,double dev,double razmah,int start)
  {
   string s=(string)start+":00";
   double Ask=SymbolInfoDouble(symb,SYMBOL_ASK);
   double Bid=SymbolInfoDouble(symb,SYMBOL_BID);

   BBHandle=iBands(symb,0,per,0,dev,0);
   CopyBuffer(BBHandle,1,0,1,up);
   CopyBuffer(BBHandle,2,0,1,dn);

   double r=up[0]-dn[0];

   if(CountTrades(symb)<1 && TimeCurrent()>StringToTime(s))
     {
      if(Ask<dn[0] && r<razmah*_Point) trade.PositionOpen(symb,0,Lot,Ask,Ask-stop*_Point,Ask+take*_Point);
      if(Bid>up[0] && r<razmah*_Point) trade.PositionOpen(symb,1,Lot,Bid,Bid+stop*_Point,Bid-take*_Point);
     }
   else if(CountTrades(symb)>0 && TimeCurrent()<StringToTime(s)) CloseAll(symb);
  }

거래 작업은 새로운 바에서 수행됩니다.

if(bars!=Bars(NULL,0))
     {
      if(Symbol1!="") SymbolTrade(Symbol1,StopLoss1,TakeProfit1,BBPeriod1,BBDev1,Razmah1,Start1);
      if(Symbol2!="") SymbolTrade(Symbol2,StopLoss2,TakeProfit2,BBPeriod2,BBDev2,Razmah2,Start2);
      if(Symbol3!="") SymbolTrade(Symbol3,StopLoss3,TakeProfit3,BBPeriod3,BBDev3,Razmah3,Start3);
        ...
     }
   bars=Bars(NULL,0);

설정:

input string Symbol1     = "USDCAD";       // 심볼1 이름
input int    StopLoss1   = 370;            // 손실 제한 1
input int    TakeProfit1 = 20;             // 이익 실현 1
input int    BBPeriod1   = 40;             // 밴드 기간 1
input double BBDev1      = 1;              // 밴드 편차 1
input double Razmah1     = 450;            // 밴드 편차 1 (포인트)
input int    Start1      = 19;             // 시작 시간 1

input string Symbol2     = "GBPUSD";       // 심볼2 이름
input int    StopLoss2   = 450;            // 손실 제한 2
input int    TakeProfit2 = 80;             // 이익 실현 2
input int    BBPeriod2   = 8;              // 밴드 기간 2
input double BBDev2      = 1;              // 밴드 편차 2
input double Razmah2     = 200;            // 밴드 편차 2 (포인트)
input int    Start2      = 20;             // 시작 시간 2

input string Symbol3     = "NZDUSD";       // 심볼3 이름
input int    StopLoss3   = 410;            // 손실 제한 3
input int    TakeProfit3 = 40;             // 이익 실현 3
input int    BBPeriod3   = 4;              // 밴드 기간 3
input double BBDev3      = 1.2;            // 밴드 편차 3
input double Razmah3     = 450;            // 밴드 편차 3 (포인트)
input int    Start3      = 19;             // 시작 시간 3

input string Symbol4     = "";             // 심볼4 이름
input int    StopLoss4   = 500;            // 손실 제한 4
input int    TakeProfit4 = 40;             // 이익 실현 4
input int    BBPeriod4   = 24;             // 밴드 기간 4
input double BBDev4      = 1;              // 밴드 편차 4
input double Razmah4     = 200;            // 밴드 편차 4 (포인트)
input int    Start4      = 20;             // 시작 시간 4

input string Symbol5     = "";             // 심볼5 이름
input int    StopLoss5   = 500;            // 손실 제한 5
input int    TakeProfit5 = 40;             // 이익 실현 5
input int    BBPeriod5   = 24;             // 밴드 기간 5
input double BBDev5      = 1;              // 밴드 편차 5
input double Razmah5     = 200;            // 밴드 편차 5 (포인트)
input int    Start5      = 20;             // 시작 시간 5

input string Symbol6     = "";             // 심볼6 이름
input int    StopLoss6   = 500;            // 손실 제한 6
input int    TakeProfit6 = 40;             // 이익 실현 6
input int    BBPeriod6   = 24;             // 밴드 기간 6
input double BBDev6      = 1;              // 밴드 편차 6
input double Razmah6     = 200;            // 밴드 편차 6 (포인트)
input int    Start6      = 20;             // 시작 시간 6

input string Symbol7     = "";             // 심볼7 이름
input int    StopLoss7   = 500;            // 손실 제한 7
input int    TakeProfit7 = 40;             // 이익 실현 7
input int    BBPeriod7   = 24;             // 밴드 기간 7
input double BBDev7      = 1;              // 밴드 편차 7
input double Razmah7     = 200;            // 밴드 편차 7 (포인트)
input int    Start7      = 20;             // 시작 시간 7

input string Symbol8     = "";             // 심볼8 이름
input int    StopLoss8   = 500;            // 손실 제한 8
input int    TakeProfit8 = 40;             // 이익 실현 8
input int    BBPeriod8   = 24;             // 밴드 기간 8
input double BBDev8      = 1;              // 밴드 편차 8
input double Razmah8     = 200;            // 밴드 편차 8 (포인트)
input int    Start8      = 20;             // 시작 시간 8

input string Symbol9     = "";             // 심볼9 이름
input int    StopLoss9   = 500;            // 손실 제한 9
input int    TakeProfit9 = 40;             // 이익 실현 9
input int    BBPeriod9   = 24;             // 밴드 기간 9
input double BBDev9      = 1;              // 밴드 편차 9
input double Razmah9     = 200;            // 밴드 편차 9 (포인트)
input int    Start9      = 20;             // 시작 시간 9

input double Lot         = 1;              // 거래량

그림1. EA 거래 결과. EURUSD, H1

그림.2. EA 거래 내역

그림3. EA 거래 및 최적화 결과 (2016.01.11 - 2016.09.13). USDCAD, GBPUSD, NZDUSD, H1

팁:

  • EA는 거래 보조 도구로 사용하거나, 자신의 전략을 개발하는 데 추천합니다.

연관 포스트

댓글 (0)