test_6period





/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//+ Trade on 6-period HLCC/4 trend NO T/P, keep adjusting S/L        |
//+------------------------------------------------------------------+

#property copyright "Ron Thompson"
#property link      "http://www.lightpatch.com/forex"

// User Input
extern double Lots = 0.1;


//+------------------------------------------------------------------+
//| What to do 1st                                                   |
//+------------------------------------------------------------------+

int init ()
  {
   return(0);
  }



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int deinit()
  {
   return(0);
  }



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double oTYP0=0, oTYP1=0, oTYP2=0, oTYP3=0, oTYP4=0, oTYP5=0;

   //
   // Error checking
   //
   
   if(Bars<100)
     {
      Print("bars less than 100");
      return(0);
     }
   
   //if(TakeProfit<10)
   //  {
   //   Print("TakeProfit less than 10");
   //   return(0);
   //  }
   
   if(AccountFreeMargin()<(1000*Lots))
     {
      Print("We have no money");
      return(0);
     }

   //
   // only one order at a time
   //

   if(OrdersTotal()<1) 
     {
      // three-period
      oTYP0=(High[0]+Low[0]+Close[0]+Close[0])/4;
      oTYP1=(High[1]+Low[1]+Close[1]+Close[1])/4;
      oTYP2=(High[2]+Low[2]+Close[2]+Close[2])/4;

      // down trend
      if(oTYP2 > oTYP1 && oTYP1 > oTYP0)
        {
         Print("SELL Order started");
         OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+0.0010,Bid-0.0020,"6P Sell",16789,0,Red);
         if(GetLastError()==0)Print("SELL Order opened : ",OrderOpenPrice());

        }
      
      // up trend
      if(oTYP2 < oTYP1 && oTYP1 < oTYP0)
        {
         Print("BUY  Order started");
         OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-0.0010,Ask+0.0020,"6P Buy",16543,0,White);
         if(GetLastError()==0)Print("BUY Order opened : ",OrderOpenPrice());
        }
     }           
      
   return(0);
  }


      //OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Points,"macd sample",16384,0,Red);
      //if(GetLastError()==0)Print("Order opened : ",OrderOpenPrice());
      //return(0);

      //OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Points,"macd sample",16384,0,Red);
      //if(GetLastError()==0)Print("Order opened : ",OrderOpenPrice());
      //return(0);

      //if(TrailingStop>0)
      //  {
      //   if(Bid-OrderOpenPrice()>Points*TrailingStop)
      //     {
      //      if(OrderStopLoss()<Bid-Points*TrailingStop)
      //        {
      //         OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Points*TrailingStop,OrderTakeProfit(),0,Red);
      //         return(0);
      //        }
      //     }
      //  }











Sample





Analysis



Market Information Used:

Series array that contains close prices for 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:



Custom Indicators Used:

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

Other Features:


BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.77 Total Net Profit:-1984.15

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.81 Total Net Profit:-1129.20

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

BackTest : GBPUSD on H1

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

BackTest : USDCAD on H1

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

BackTest : USDCHF on H1

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

BackTest : USDJPY on H1

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

Request Backtest for test_6period


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

Pair: Period: