//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |  
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_separate_window

//-------
   int  Countbar=9;
   double open,close,high,low;
   double   body;
   double  volume_all;
   double   vol_A;
   double   vol_B;
   double   vol_G;
   double   vol_D;
   double   vol_buy;
   double   vol_sell;
   int i;
   int shift, num;
//-------
   void ObjDel()
   {
      for (;num<=Countbar;num++)
      {
      ObjectDelete("SING_0["+num+"]");
      ObjectDelete("SING_2["+num+"]");
      ObjectDelete("SING_3["+num+"]");
      ObjectDelete("SING_4["+num+"]");
      ObjectDelete("SING_5["+num+"]");
      ObjectDelete("SING_1 ["+num+"]");
      ObjectDelete("SING ["+num+"]");
      ObjectDelete("1SING ["+num+"]");
      ObjectDelete("2SING ["+num+"]");
      ObjectDelete("3SING ["+num+"]");
      ObjectDelete("4SING ["+num+"]");

      }
   }


//-------


int init()
  {
 Comment("--------------------------------" + "\n" +
           " منتديات_المتداول_العربي \n" +
           "--------------------------------" + "\n" +
           "AF159_أبوزياد \n" +
           "--------------------------------" + "\n" +
           "AF159@hotmail.com \n" +
           "--------------------------------");

   IndicatorShortName("AF159_VOL");
   
  return(0);
  }
//-------

int deinit()
  {

   ObjDel();
   Comment("");

   return(0);
  }
//-------
int start()
  {

  ObjDel();

  num=0;
  for (shift=Countbar-1;shift>=0;shift--)
  {

  i=shift-1;


   high  = iHigh(NULL,Period(),shift+0);
   low   = iLow(NULL,Period(),shift+0);
   open   = iOpen(NULL,Period(),shift+0);
   close = iClose(NULL,Period(),shift+0);
   volume_all=iVolume(NULL,Period(),shift+0);

   vol_A= (( close - open ) / ( high - low ))*100;
   vol_B= (volume_all / 100)*vol_A;
   vol_G= volume_all - MathAbs( vol_B );
   vol_D= vol_G / 2 ;

   if( open < close ){
   vol_buy = vol_B + vol_D ;
   }
   if( open > close ){
   vol_buy = vol_D ;
   }

   if( open < close ){
   vol_sell = vol_D ;
   }
   if( open > close ){
   vol_sell = MathAbs( vol_B ) + vol_D ;
   }


  num=shift;

   ObjectCreate("4SING ["+num+"]", OBJ_TEXT, 0, Time[shift],High[shift]+5*Point);
   ObjectSetText("4SING ["+num+"]", DoubleToStr(shift+1,0), 8, "Arial", Red);
   ObjectMove("4SING ["+num+"]", 0, Time[shift],High[shift]+10*Point);

   ObjectCreate("SING_0["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("SING_0["+num+"]", "الشموع", 14, "Arial", Aqua);
   ObjectSet("SING_0["+num+"]", OBJPROP_XDISTANCE, 3);
   ObjectSet("SING_0["+num+"]", OBJPROP_YDISTANCE, 20);

   ObjectCreate("SING_2["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("SING_2["+num+"]", "النسبة المئوية", 14, "Arial", Aqua);
   ObjectSet("SING_2["+num+"]", OBJPROP_XDISTANCE, 3);
   ObjectSet("SING_2["+num+"]", OBJPROP_YDISTANCE, 60);

   ObjectCreate("SING_3["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("SING_3["+num+"]","الفوليوم الكلي", 14, "Arial", Aqua);
   ObjectSet("SING_3["+num+"]", OBJPROP_XDISTANCE, 3);
   ObjectSet("SING_3["+num+"]", OBJPROP_YDISTANCE, 80);

   ObjectCreate("SING_4["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("SING_4["+num+"]","فوليوم_الشراء", 14, "Arial", Aqua);
   ObjectSet("SING_4["+num+"]", OBJPROP_XDISTANCE, 3);
   ObjectSet("SING_4["+num+"]", OBJPROP_YDISTANCE, 110);

   ObjectCreate("SING_5["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("SING_5["+num+"]", "فوليوم_البيع", 14, "Arial", Aqua);
   ObjectSet("SING_5["+num+"]", OBJPROP_XDISTANCE, 3);
   ObjectSet("SING_5["+num+"]", OBJPROP_YDISTANCE, 140);

   ObjectCreate("SING_1 ["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("SING_1 ["+num+"]", DoubleToStr(shift+1,0), 14, "Arial", Yellow);
   ObjectSet("SING_1 ["+num+"]", OBJPROP_XDISTANCE, 800-(i*100));
   ObjectSet("SING_1 ["+num+"]", OBJPROP_YDISTANCE, 20);
      if(vol_A>0){
   ObjectCreate("SING ["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0,0);
   ObjectSetText("SING ["+num+"]","%  "+DoubleToStr(vol_A,0), 12, "Arial", Lime);
   ObjectSet("SING ["+num+"]",OBJPROP_XDISTANCE,800-(i*100));
   ObjectSet("SING ["+num+"]",OBJPROP_YDISTANCE, 60);
      }if (vol_A<=0){
   ObjectCreate("SING ["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0,0);
   ObjectSetText("SING ["+num+"]","%  "+DoubleToStr(vol_A,0), 12, "Arial", Red);
   ObjectSet("SING ["+num+"]",OBJPROP_XDISTANCE,800-(i*100));
   ObjectSet("SING ["+num+"]",OBJPROP_YDISTANCE, 60);
      }
   ObjectCreate("1SING ["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("1SING ["+num+"]", DoubleToStr(volume_all,0), 12, "Arial", White);
   ObjectSet("1SING ["+num+"]", OBJPROP_XDISTANCE, 800-(i*100));
   ObjectSet("1SING ["+num+"]", OBJPROP_YDISTANCE, 80);

   ObjectCreate("2SING ["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("2SING ["+num+"]", DoubleToStr(vol_buy,2), 12, "Arial", White);
   ObjectSet("2SING ["+num+"]", OBJPROP_XDISTANCE, 800-(i*100));
   ObjectSet("2SING ["+num+"]", OBJPROP_YDISTANCE, 110);

   ObjectCreate("3SING ["+num+"]", OBJ_LABEL,WindowFind("AF159_VOL"), 0, 0);
   ObjectSetText("3SING ["+num+"]", DoubleToStr(vol_sell,2), 12, "Arial", White);
   ObjectSet("3SING ["+num+"]", OBJPROP_XDISTANCE, 800-(i*100));
   ObjectSet("3SING ["+num+"]", OBJPROP_YDISTANCE, 140);



} 


  
   return(0);
  }
//+------------------------------------------------------------------+


