Skip to main content

Weekly high and low for Amibroker (AFL)

Orange2000 almost 10 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 5)
  • Tags:
    amibroker, trading system

My own simple system. Work well on some futures. Try to find by yourself.
Use 1 minute frame.

Wait for 15 minutes after market open.
During main session BUY if price go above weekly high and SHORT if price go below weekly low.
Sell or Cover at middle of the next session.( 1 p.m. in my system)
Also use stops (in points) if things goes wrong)

Indicator / Formula

Copy & Paste Friendly
Opt1 = Optimize("stop", 300, 25, 700, 25);

TimeCond = TimeNum() >= 101500 AND TimeNum() < 170000;// session time
TN = TimeNum(); 

NW = DayOfWeek() < Ref(DayOfWeek(), -1); 
ND = DayOfWeek() != Ref(DayOfWeek(), -1); 
WH = HHV(H, BarsSince(NW)+1); 
WL = LLV(L, BarsSince(NW)+1); 

Buy = H > Ref(WH, -1) AND TimeCond; 
Short = L < Ref(WL, -1) AND TimeCond; 

BuyPrice = Max(Ref(WH, -1), O); 
ShortPrice = Min(Ref(WL, -1), O); 
SellPrice = CoverPrice = C; 

pos = ED = 0; 
for( i = 0; i < BarCount; i++ ) 
{ 
   if(pos == 0) 
   { 
      if(Buy[i] OR Short[i]) 
      { 
         pos = 1; 
         ED = 1; 
      } 
   } 
   else if(pos == 1) 
   { 
      Buy[i] = 0; 
      Short[i] = 0; 
      if(ND[i] == 1) 
         ED = 0; 
      else if(TN[i] == 130000 AND ED == 0) 
      { 
         pos = 0; 
         Sell[i] = Cover[i] = 1; 
      } 
   } 
} 

ApplyStop(stopTypeLoss, stopModePoint, Opt1, ExitAtStop = 1); 

0 comments

Leave Comment

Please login here to leave a comment.