//+------------------------------------------------------------------+
//| Meter.mq4 |
//| Copyright 2023, |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023"
#property link ""
#property version ""
#property strict
color clr[10]={Red,OrangeRed,DarkOrange,Orange,Gold,Yellow,GreenYellow,LawnGreen,Lime,Lime};
int count_step=0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
MeterCreate();
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectsDeleteAll();
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void MeterCreate()
{
for(int i=0; i<10; i++)
objectCreate("ind"+string(i),30,30+(i*7));
}
//+------------------------------------------------------------------+
void objectCreate(string name,int x,int y,string text="-",int size=42,
string font="Arial",color colour=CLR_NONE)
{
ObjectCreate(name,OBJ_LABEL,0,0,0);
ObjectSet(name,OBJPROP_CORNER,3);
ObjectSet(name,OBJPROP_COLOR,colour);
ObjectSet(name,OBJPROP_XDISTANCE,x);
ObjectSet(name,OBJPROP_YDISTANCE,y);
ObjectSetText(name,text,size,font,colour);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
int step=5;// шаг индикации
int i=(int)(ProfitToday/step);//замените ProfitToday на нужную переменную
if(i>10) i=10;
//----------------------
if(count_step!=i)
{
for(int s=10; s>=i; s--)
ObjectSet("ind"+string(s),OBJPROP_COLOR,CLR_NONE);
for(int k=0; k<i; k++)
ObjectSet("ind"+string(k),OBJPROP_COLOR,clr[k]);
count_step=i;
}
}
//+------------------------------------------------------------------+
int step=5;// шаг индикации
int i=(int)(ProfitToday/step);//замените ProfitToday на нужную переменную
if(i>10) i=10;
FEEX