Here is one way to check for sequential dots

signal = iif(ref(finalmovavg < L, -1) and finalmovavg < L, 1, 0);//2 green in a 
row
  ----- Original Message ----- 
  From: Deepak Patade 
  To: [email protected] 
  Sent: November 19, 2009 11:22 AM
  Subject: Fwd: [amibroker] some functional help needed in modifying this afl





  any takers on this
  can i use flip or something like that
  learned ones
  do suggest


  ---------- Forwarded message ----------
  From: Deepak Patade <[email protected]>
  Date: Thu, Nov 19, 2009 at 6:21 PM
  Subject: [amibroker] some functional help needed in modifying this afl [1 
Attachment]
  To: [email protected]



    
  [Attachment(s) from Deepak Patade included below]
   

  i have a afl triangular , i slightly modified it to get signals
  i want signal every time a green dot appears for two consecutive times and if 
after one green dot a red appers the previous is green is to be nullified and 
it has to wait again for two green dots in a sequence.( the other way for red 
dots also)
  BUT
  afl gives redundant signal
  see file attached
  what is to be incorporated to filter this ,
  I know somethingis missing tried hard
  This is a traingular moving average ( afl library)  slightly modified by me

  Odd=13;//enter Odd numbers only
  CoefOdd=round(Odd/2);
  Even=12;//enter Even numbers only
  Coefeven=Even/2;
  Coefeven2=Coefeven+1;
  CongestionPercent=2.8;/*Set % above/below Moving average for congestion / 
sideways market*/
  TriangularOdd=MA(MA(C,CoefOdd),CoefOdd);
  TriangularEven=MA(MA(C,Coefeven),Coefeven2);
  finalMov_avg=IIf(Odd > even,triangularOdd,TriangularEven);
  colordots = IIf(finalMov_avg < L,colorBrightGreen,IIf(finalMov_avg > 
H,colorRed,colorWhite));
  Buy = Cross(C,finalMov_avg); Buy = Ref(Buy,-1); BuyPrice = O;
  Sell = Cross(finalMov_avg,C); Sell = Ref(Sell,-1); SellPrice = O;
  SetBarsRequired(-2,-2);
  SetChartOptions(0, chartShowDates);
  Plot(C,"\nClose",colorWhite,64);
  Plot(finalMov_avg,"\finalMov_avg",colordots,styleDots|styleNoLine);
  Color=colorBrightGreen;//select Moving average line color
  tickercolor=colorBlack;//select price color
  Plot(finalMov_avg,"",IIf(C < 
finalmov_avg,colorRed,Color),styleLine|styleThick);
  Plot(C,"",tickercolor,styleCandle);
  Short = Sell;
  Cover = Buy;
  Buy = ExRem(Buy,Sell);
  Sell= ExRem(Sell,Buy);
  Short=ExRem(Short,Cover);
  Cover=ExRem(Cover,Short);

  Please help out







  

Reply via email to