All those IIF are not needed at all, because boolean conditions result in 1 or 
0 results by themselves:

So you can REMOVE all those IIFs.

FD1 = H > Ref(H,2) AND H > Ref(H,1) AND H > Ref(H,-1) AND H > Ref(H,-2));
FD2 = H < Ref(H, 3 ) AND FD1;
FD3 = H < Ref(H, 4 ) AND FD2;

BTW: You are aware that your code looks into the future, aren't you?

Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: Mubashar Virk 
  To: [email protected] 
  Sent: Sunday, April 26, 2009 9:20 AM
  Subject: Re: [amibroker] HELP: Fractals are not Plotting





  WOW! To the Simplicity of the AFL!!
  Thank you very much, sir.


  From: wavemechanic 
  Sent: Sunday, April 26, 2009 3:10 AM
  To: [email protected] 
  Subject: Re: [amibroker] HELP: Fractals are not Plotting


   

  Change your definitions as follows:

  fd1 = iif( .... , 1, 0);
  fd2 = iif( h > ref(h, 3) and fd1, 1, 0);
  fd2 = iif( h > ref(h, 4) and fd2, 1, 0);

  and the same for fu1, fu2, and fu3

  Then it will plot OK
    ----- Original Message ----- 
    From: Mubashar Virk 
    To: [email protected] 
    Sent: April 25, 2009 5:55 PM
    Subject: [amibroker] HELP: Fractals are not Plotting


    Can someone please help with the following code. I am not getting the 
fractal shapes to plot.
    THanks in advance.

    COLOR = IIf(C > O, colorGreen, colorRed);

    
//SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);

    _N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} 
{{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + 
" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );

    Plot( C, "Close", Color, styleBar | styleThick | styleNoTitle );

     

    _SECTION_BEGIN("F");

    //SetBarsRequired(200,0);

    FD1 = IIf((H > Ref(H,2) AND H > Ref(H,1) AND H > Ref(H,-1) AND H > 
Ref(H,-2)),1,0);

    FD2 = IIf((H > Ref(H,3) AND H > Ref(H,2) AND H=Ref(H,1) AND H > Ref(H,-1) 
AND H > Ref(H,-2)),1,0);

    FD3 = IIf((H > Ref(H,4) AND H > Ref(H,3) AND H=Ref(H,2) AND H >= Ref(H,1) 
AND H > Ref(H,-1) AND H > Ref(H,-2)),1,0);

     

    FU1 = IIf((L < Ref(L,2) AND L < Ref(L,1) AND L < Ref(L,-1) AND L < 
Ref(L,-2)),1,0);

    FU2 = IIf((L < Ref(L,3) AND L < Ref(L,2) AND L = Ref(L,1) AND L < Ref(L,-1) 
AND L < Ref(L,-2)),1,0);

    FU3 = IIf((L < Ref(L,4) AND L < Ref(L,3) AND L = Ref(L,2) AND L <= Ref(L,1) 
AND L < Ref(L,-1) AND L < Ref(L,-2)),1,0);

     

    PlotShapes( IIf(FD1 OR FD2 OR FD3, shapeSmallCircle,0) , 
colorOrange,0,H,10);

    PlotShapes( IIf(FU1 OR FU2 OR FU3, shapeSmallCircle,0) , colorLime,0,L,-10);

    _SECTION_END();





  

Reply via email to