[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

el question day of week statement



PureBytes Links

Trading Reference Links

I added the following statement to a system while trying to include the weekly
avg for daily data into a system to insure a trend in two time frames, It
increased the number of trades and greatly improved the returns on the SP 500
daily. The statement IF DAYOFWEEK(DATE) < DAYOFWEEK(DATE[1]) THEN BEGIN when
removed decreases returns with several stopped trades. Any insight would be
appreciated. I'm posting the whole system not the returns, I'd be interested in
knowing anyone else tries backtesting it. If anyone requests I'll send the ELA.
Thanks for any insight.
{*******************************************************************************
*****************************}
{ I used Max Bars Back Defaulted at 50}



   input: stoploss(.0625),BuyZone(40),SellZone(60), LENGTH(5);

 ARRAY:HARRAY[200](0),LARRAY[200](0);
 
 IF DAYOFWEEK(DATE) < DAYOFWEEK(DATE[1]) THEN BEGIN

     VALUE4 = 0; VALUE5 = 0;

     HARRAY[LENGTH + 1] = VALUE1;
     LARRAY[LENGTH + 1] = VALUE2;

     FOR VALUE0 = 1 TO LENGTH BEGIN

          HARRAY[VALUE0] = HARRAY[VALUE0 + 1];
          LARRAY[VALUE0] = LARRAY[VALUE0 + 1];
          VALUE4 = VALUE4 + HARRAY[VALUE0];
          VALUE5 = VALUE5 + LARRAY[VALUE0];
      
     END;
                     
     VALUE1 = H;
     VALUE2 = L;
     VALUE3 = 0;
     VALUE6 = ROUND(VALUE4 / LENGTH,2);
     VALUE7 = ROUND(VALUE5 / LENGTH,2);


 IF H > VALUE1 THEN VALUE1 = H;
 IF L < VALUE2 THEN VALUE2 = L;
 
 end;
 If currentbar > 1 and  DMIPlus(14) > DMIMinus(14) and ADX(14) > 35 and
  FastK(8) <= BuyZone and value6 > value6[1] 
 then begin Buy ("Long") High + .0625 stop;
 end;
   
  ExitLong ("StopLoss") from entry ("Long") At$ Low - stoploss  stop;

   if FastK(8) crosses below 80 then exitlong;

{******************************************************************}

 If CurrentBar >1 and  ADX(14) > 35 and DMIMinus(14) > DMIPlus(14) and
  FastK(8) >= SellZone and value7 < value7[1] 
   
      Then begin Sell ("Short") Low - .0625 stop;
 end;

 ExitShort ("StopLossShort") from entry ("Short") At$ High + stoploss stop;
 
 
     If FastK(8) crosses above 20 then exitshort;




  

"The darkest hour in any man's life is when he sits down to plan
 how to get money without earning it"

Sentinel Trading