Hello ! I need your help to color the six highest numbers in a gfx programm .
The purpose is to do a kind of sector analysis .        
For the instant all my sectors indicators are drawn with green rectangles .
But I want to color the six highest numbers in green and the six lowest 
rectangles in red .I can do something like this with filter and column but in 
gfx programming it's harder …
I think I need to create a number's array with a loop and a function to select 
by ascending or descending order . 
The AFL code has been done for Paris European market and his sector's 
indicators .The programm I think have no bug .


_SECTION_BEGIN("Sector's selection");

 
b= Foreign("^FCHI","Close");  //european indicator
//           ----------------------------------------------  2 nd step

GfxSelectFont( "Tahoma", 6.5 ); 

function dessineaxex(Y,Color)
{
    global pxwidth; 
    global pxheight;

    GfxSelectPen( Color ) ;
    GfxMoveTo( 0, Y);
    GfxLineTo( pxwidth, Y);
}


function dessineaxey(X,Color1)
{
    GfxSelectPen( Color1 ) ;
    GfxMoveTo( X, 0);
    GfxLineTo( X, pxheight);

}

function dessinebarre(textindicesectoriel,x1,y1,x2,y2)

{

GfxSelectPen( colorGreen, 2 );
GfxRectangle(x1,y1,x2,y2);

}

function dessinetext(textindicesectoriel,x1,y1)

{
GfxTextOut(textindicesectoriel,x1,y1);
}

//           ----------------------------------------------  1 step
 
  
  stockname = Name();
  sectorname = SectorID();   
  listdestocks = CategoryGetSymbols( categoryIndex, sectorname ) ;     
  nbstock = 0 ;

//           ------------------- 1.1  
  pxwidth = Status("pxwidth");  
  pxheight = Status("pxheight"); 
  pxTopArea = 20;
  pxBottomArea = pxheight - 10 ;


  pxadroite = pxwidth - 20;
  pxagauche = 10;

  Color = colorGreen;
  Color1 = colorRed;

//         --------------------- end 1.1 

for( i = 0; (sym = StrExtract( listdestocks, i ) ) != ""; i++ )  
  {
   nbstock = i ;

  }
  nbstock++ ;  
  Valeurintervalle = (pxadroite-pxagauche)/nbstock; 
  graduationn =0;

for( i = 1; i < nbstock; i++ )  
  {
   for( i = 0; (sym = StrExtract( listdestocks, i ) ) != ""; i++ )   
   {
   action = Foreign( sym, "Close");
   Rapport = action/b; 
   basepricedetest = MA(Rapport,13);  
   Courbemansfield = ((Rapport/basepricedetest));


   graduationn = Valeurintervalle*i;  
  dessinebarre(sym,graduationn,pxBottomArea-20,graduationn + 10 
,pxBottomArea-20-(LastValue(Courbemansfield))*100);
  dessinetext(sym,graduationn,pxBottomArea-10);
  dessinetext(NumToStr(LastValue(Courbemansfield),1.3),graduationn + 
10,pxBottomArea-20-(LastValue(Courbemansfield))*100);
  }
  }

 dessineaxex(pxTopArea,Color);  
 dessineaxex(pxBottomArea,Color);
 dessineaxey(pxagauche, Color1);
 dessineaxey(pxadroite, Color1);
 
Filter = 1 ;
AddColumn(Courbemansfield,"Courbe Mansfield",1.2);

_SECTION_END();



Reply via email to