Exp_Sidus





//+------------------------------------------------------------------+
//|                                                    Exp_Sidus.mq4 |
//|                                                     Yuriy Tokman |
//|                                            yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link      "yuriytokman@gmail.com"

extern double TP = 80;
extern double SL = 20;
extern double Lots = 0.1;
extern int shif =1;

 int period_MA1 =5;
 int period_MA2 =12;
 int ma_method =0;//0-4
 int applied_price = 0;//0-6
 int period_RSI = 21;
 int applied_RSI = 0;//0-6

datetime LastTime=0;

int start()
  {
//----
   int cnt, ticket, total;
   
   total=OrdersTotal();
   if(total<1) 
     {
      if(GetSignal()==1 && Time[shif]!= LastTime)
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-SL*Point,Ask+TP*Point,"",28081975,0,Green);
         if(ticket>0)LastTime = Time[shif];
         return(0); 
        }
      if(GetSignal()==-1 && Time[shif]!= LastTime)
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+SL*Point,Bid-TP*Point,"",28081975,0,Red);
         if(ticket>0)LastTime = Time[shif];
         return(0); 
        }
      return(0);
     }      
//----
   for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
        {
         if(OrderType()==OP_BUY)
           {
            if(GetSignal()==-1)
                {
                 OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                 return(0);
                }
           }
         else 
           {
            if(GetSignal()==1)
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
               return(0);
              }
           }
        }
     }   
//----
   return(0);
  }
//+------------------------------------------------------------------+

double GetSignal()
 { 
  double FastEMA=iMA(NULL,0,period_MA1,0,ma_method,applied_price,shif);
  double SlowEMA=iMA(NULL,0,period_MA2,0,ma_method,applied_price,shif);
  double PrevFastEMA=iMA(NULL,0,period_MA1,0,ma_method,applied_price,shif+1);
  double PrevSlowEMA=iMA(NULL,0,period_MA2,0,ma_method,applied_price,shif+1);  
  double rsi= iRSI(NULL,0,period_RSI,applied_RSI,shif);  
 
  int vSig=0;
  if(PrevFastEMA<=PrevSlowEMA && FastEMA>SlowEMA && rsi>50 )vSig = 1;
  else
  if(PrevFastEMA>=PrevSlowEMA && FastEMA<SlowEMA && rsi<50 )vSig =-1;
  return(vSig); 
 }



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:


Indicators Used:

Moving average indicator
Relative strength index


Custom Indicators Used:

Order Management characteristics:
Checks for the total of open orders
It automatically opens orders when conditions are reached

It Closes Orders by itself

Other Features:

BackTest : EURUSD on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.21 Total Net Profit:-61.70

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCHF on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:1.08 Total Net Profit:8.00

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.41 Total Net Profit:-137.20

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCAD on H1

From 2009-01-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-03-01 to 2010-03-27 Profit Factor:0.49 Total Net Profit:-24.60

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-04-16 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

Request Backtest for Exp_Sidus


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: