советник здесь
демонстрация работы: youtu.be/SoFgt347G9w
int step=ProfitToday/10;// шаг индикации
int i=(int)(ProfitToday/step);//замените ProfitToday на нужную переменную
int step=5;// шаг индикации
int i=(int)(ProfitToday/step);//замените ProfitToday на нужную переменную
if(i>10) i=10;
<code>int step=ProfitToday/10;// шаг индикации</code>
objectCreate("ind2"+string(i),40+(i*7),30);
if(...)
{
for(...)
ObjectSet("ind2"+string(s),OBJPROP_COLOR,CLR_NONE);
for(...)
ObjectSet("ind2"+string(k),OBJPROP_COLOR,clr[k]);
}
}
objectCreate("ind"+string(i),30,30+(i*7));
objectCreate("ind"+string(i),30+(i*7),30);
//+------------------------------------------------------------------+
//| 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(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;
}
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| 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};
//+------------------------------------------------------------------+
//| 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()
{
double Bal=AccountInfoDouble(ACCOUNT_BALANCE);
double Free=AccountInfoDouble(ACCOUNT_MARGIN_FREE);
double step=Bal/10;
int i=(int)(Free/step);
//----------------------
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]);
}
//+------------------------------------------------------------------+
Price1 = ObjectGet(NAME, OBJPROP_PRICE1);
//+------------------------------------------------------------------+
//| Номер бара фрактала |
//+------------------------------------------------------------------+
int FractalNum(int num,int mode)
{
double f=0;
int p=0,dn=0,n=0;
for(int i=2; i<100; i++)
{
f=iFractals(NULL,0,MODE_UPPER,i);
if(f>0 && mode==1)
{
n++;
if(n==num)
{
p=i;
break;
}
}
f=iFractals(NULL,0,MODE_LOWER,i);
if(f>0 && mode==2)
{
n++;
if(n==num)
{
p=i;
break;
}
}
}
return(p);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
int r=0;
double upf1=FractalPrice(1,1);
double upf2=FractalPrice(2,1);
double dnf1=FractalPrice(1,2);
double dnf2=FractalPrice(2,2);
double num_upf1=FractalNum(1,1);
double num_upf2=FractalNum(2,1);
double num_dnf1=FractalNum(1,2);
double num_dnf2=FractalNum(2,2);
bool buy = (dnf1>dnf2 && upf1>dnf1 && upf1>dnf2 && num_dnf1<num_upf1 && num_upf1<num_dnf2 && num_dnf2<num_upf2);
bool sell = (upf1<upf2 && dnf1<upf1 && dnf1<upf2 && num_upf1<num_dnf1 && num_dnf1<num_upf2 && num_upf2<num_dnf2);
if(CountTrades()<1)
{
if(buy && Bid<upf1 && CountOrders(4)<1)
{
r=OrderSend(NULL,4,Lots,upf1,Slip,dnf2,upf1+(upf1-dnf2),"",Magic,TimeCurrent()+Expiration*3600,Blue);
}
if(sell && Bid>dnf1 && CountOrders(5)<1)
{
r=OrderSend(NULL,5,Lots,dnf1,Slip,dnf2,dnf1-(upf2-dnf1),"",Magic,TimeCurrent()+Expiration*3600,Red);
}
}
}
//+------------------------------------------------------------------+
Open[3]<Close[3] && Close[2]>High[3] && Close[1]<Low[2];// Медвежий тренд
d_shift_3 = AccountEquity() / (MarketInfo(Symbol(), MODE_TICKVALUE) * lots);
d_shift_3 = (AccountEquity() - AccountStopoutLevel()) / MarketInfo(Symbol(), MODE_TICKVALUE) * lots;
verta81