domi-harvest





#property copyright "Copyright© Domi-Harvest 2009"
#property link "jadvir@gmail.com"
extern double Deposit       =  10000 ;
extern double Risk          =  10;
extern double TrailingStop  =  20;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double Lots,Lot,Hi,Lo,Sell,Buy,By,Sl,Tg,Tpb,Tps,TR,TpB,TpS,Stop,Fma,Sma,Fma1,Sma1,Lot1;
   double Fma2,Fma3,Sma2,Sma3,Sma4,Fma4,Fma5,Sma5,close,StoM,StoS,TakeProfit,Rsi;
   int cnt,total,i;
   
   Rsi=iRSI(NULL,0,5,PRICE_CLOSE,0);
   Fma1=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,0);
   Sma1=iMA(NULL,0,26,0,MODE_EMA,PRICE_CLOSE,0);   
   StoM=iStochastic(NULL,PERIOD_H1,5,3,3,MODE_EMA,0,MODE_MAIN,0);
   StoS=iStochastic(NULL,PERIOD_H1,5,3,3,MODE_EMA,0,MODE_SIGNAL,0);
   Fma1=iMA(NULL,PERIOD_H1,9,0,MODE_EMA,PRICE_CLOSE,0);
   Sma1=iMA(NULL,PERIOD_H1,5,0,MODE_EMA,PRICE_CLOSE,0);

   if (AccountBalance()>=Deposit*2)
   Lots= ((AccountBalance()/100000*Risk)/2);
   Lot=NormalizeDouble(Lots,1);
   
   if (OrderProfit()>=500 && OrderProfit()<=700)
   Lots= ((AccountBalance()/100000*Risk)*1.5);
   Lot=NormalizeDouble(Lots,1);
   
   if (AccountBalance()<=Deposit)
   Lots= ((AccountBalance()/100000*Risk)/4);
   Lot=NormalizeDouble(Lots,1);
   
   Lots= (AccountBalance()/100000*Risk);
   Lot=NormalizeDouble(Lots,1);
      
  total=OrdersTotal();
   if(total<1)

   {
      // Normal Tradee with adjustable risk
      
        Comment( 
        " ----------------------------------------\n",
        " Name   ",AccountName(),"\n",
        " ----------------------------------------\n",
        " Trading Signal NONE \n",
        " Trading Lot              ",Lot," Lot","\n", 
        " ----------------------------------------\n", 
        " Profit       $",AccountBalance()-Deposit,"\n", 
        " ----------------------------------------");
    
        
 // check for long position (BUY) possibility
  
        
        if (Volume[0]<2)  return;

        if ( Rsi>70 && StoM>StoS && Bid>Open[0] && Hour()>=1 && Hour()<=23)  
               {
         OrderSend(Symbol(),OP_BUY,Lot,Ask,5,0,Bid+20*Point,0,0,Green);
        }
       if ( Rsi<30 && StoM<StoS && Bid<Open[0] && Hour()>=1 && Hour()<=23) 
        {
         OrderSend(Symbol(),OP_SELL,Lot,Bid,5,0,Ask-20*Point,0,0,Red);
        }
        
     }
     
       
     // CHECK WHEN TO COLLECT YOUR PROFIT FROM THE MARKET 
   for(cnt=0;cnt<total;cnt++)
     {
      if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==false)break;
      if(OrderSymbol()!=Symbol()) continue;
      if(OrderType()<=OP_SELL &&   // check for opened position
         OrderSymbol()==Symbol())  // check for symbol
        {
         if(OrderType()==OP_BUY)   // long position is opened
           {
            // should it be closed?
           
         if((Bid==High[3]) )
                {
                 OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                 return(0); // exit
                }
            // check for trailing stop
            if(TrailingStop>0)
              {                 
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
                     return(0);
                    }
                 }
              }
           }
         
         else // go to short position
           {
           if((Ask==Low[3]))
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
               return(0); // exit
              }
            // check for trailing stop
            if(TrailingStop>0)
              {                 
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
                     return(0);
                    }
                 }
              }
           }
        }
     }
   return(0);
  }
// the end.



Sample





Analysis



Market Information Used:

Series array that contains tick volumes of each bar
Series array that contains open prices of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:


Indicators Used:

Relative strength index
Moving average indicator
Stochastic oscillator


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
It can change open orders parameters, due to possible stepping strategy

Other Features:


BackTest : EURUSD on H1

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

BackTest : USDJPY on H1

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

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.22 Total Net Profit:-5935.90

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.00 Total Net Profit:-8995.28

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.13 Total Net Profit:-4904.46

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 domi-harvest


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

Pair: Period: