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

[amibroker] Coloring the six highest numbers (gfx programming)



PureBytes Links

Trading Reference Links

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();





------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/