
#property copyright "eevviill"
#property link      "itisallillusion@gmail.com"

#property indicator_chart_window


extern string Leverage = "Leverage";
extern bool Show_Leverage = false;
extern int Leverage_Cor = 1;
extern int Leverage_X = 20;
extern int Leverage_Y = 20;
extern int Leverage_Size = 9;
extern color Leverage_Color = Orange;


extern string pus1 = "";
extern string Margin_required = "Margin for 0.1 Lot";
extern bool Show_Margin_required = false;
extern int Margin_required_Cor = 1;
extern int Margin_required_X = 20;
extern int Margin_required_Y = 40;
extern int Margin_required_Size = 9;
extern color Margin_required_Color = CornflowerBlue;

extern string pus2 = "";
extern string Margin_req_all = "Лот на всю котлету";
extern bool Show_Margin_req_all = true;
extern int Margin_req_all_Cor = 2;
extern int Margin_req_all_X = 10;
extern int Margin_req_all_Y = 10;
extern int Margin_req_all_Size = 9;
extern color Margin_req_all_Color = White;





////////////////
int init()
  {
  
IndicatorShortName("All in");

   return(0);
   
  }

////////////////
int deinit()
  {

 if(Show_Leverage)         ObjectDelete(Leverage);
 if(Show_Margin_required)  ObjectDelete(Margin_required);
 if(Show_Margin_req_all)   ObjectDelete(Margin_req_all);
 
   return(0);
   
  }



//////////////////////////////////
int start()
  {
  
 if(Show_Leverage)         Draw(Leverage,DoubleToStr(AccountLeverage(),0),Leverage_X,Leverage_Y,Leverage_Size,Leverage_Color,Leverage_Cor); 
 if(Show_Margin_required)  Draw(Margin_required,DoubleToStr((MarketInfo(Symbol(),MODE_MARGINREQUIRED))/10,2),Margin_required_X,Margin_required_Y,Margin_required_Size,Margin_required_Color,Margin_required_Cor);
 if(Show_Margin_req_all)   Draw(Margin_req_all,DoubleToStr(MathFloor(AccountFreeMargin()/MarketInfo(Symbol(),MODE_MARGINREQUIRED)/MarketInfo(Symbol(),MODE_LOTSTEP))*MarketInfo(Symbol(),MODE_LOTSTEP),2),Margin_req_all_X,Margin_req_all_Y,Margin_req_all_Size,Margin_req_all_Color,Margin_req_all_Cor);

   return(0);
   
  }




//draw func
////////////////////////////////////////////////////////////////////////
void Draw(string name,string object,int X_distance,int Y_distance,int Size_Data, color Color,int corner)
{

if(ObjectFind(name)==-1)
{
ObjectCreate(name,OBJ_LABEL,0,0,0);
ObjectSet(name,OBJPROP_CORNER,corner);
ObjectSet(name, OBJPROP_XDISTANCE,X_distance);
ObjectSet(name, OBJPROP_YDISTANCE, Y_distance);
}
ObjectSetText(name,name+": "+object,Size_Data,"Arrial",Color);

}



 




