Saturday, 27 October 2012

logic tradetime


jumat tidak trading
//taro dibagian atas
extern bool   OPFriday = false;  //artinya false = tidak buka posisi baru di hari jumat

//replace tradetime dgn yg ini
bool TradeTime() 
{
   bool TradingTime = false;
   if(StartTime < StopTime)
   {
      if (Hour() >= StartTime && Hour() <= StopTime) TradingTime = true;
      if(OPFriday == false)
      {
         if(TradingTime == true)
         {
            if(DayOfWeek() == 5) TradingTime = false;
         }
      }
   }   
   else if(StartTime > StopTime)
   {
      if (Hour() >= StartTime || Hour() <= StopTime) TradingTime = true;
      if(OPFriday == false)
      {
         if(TradingTime == true)
         {
            if(DayOfWeek() == 5 && Hour() < StartTime) TradingTime = false;
         }
      }
      if(DayOfWeek() == 5 && Hour() >= StartTime)  TradingTime = false;
   }
   return(TradingTime); 
}

No comments:

Post a Comment