The essence of the question is that I need to count the number of bars in each continuous block of the bar diagram of the top indicator. I wrote such an indicator (the lowest). In it, the value of each bar chart column corresponds to the number of bars in a continuous block of the top indicator, but it starts displaying ONLY since its installation (the red vertical line).I want it to be displayed on the previous bars (like when you install AO or CCI), i.e. the "picture" was similar to the middle indicator (it is the same indicator, but installed even earlier). I will listen to any suggestions with gratitude (preferably with code snippets).
The essence of the question is that I need to count the number of bars in each continuous block of the bar diagram of the top indicator. I wrote such an indicator (the lowest). In it, the value of each bar chart column corresponds to the number of bars in a continuous block of the top indicator, but it starts displaying ONLY since its installation (the red vertical line).But I need it to be displayed on previous bars also (like when you install AO or CCI), i.e. the "picture" was similar to the middle indicator (it is the same as lower indicator, but it was installed even earlier).
Something like this?
-
#property indicator_separate_window#property indicator_buffers 2#property indicator_color1 DodgerBlue#property indicator_color2 Bisque#property indicator_width1 2#property indicator_width2 2//===============================double fx1[],fx2[];
double ao,ao1;
int ti,n,fs;
//******************************************************************int init()
{
SetIndexBuffer(0,fx1); SetIndexStyle(0,2);
SetIndexBuffer(1,fx2); SetIndexStyle(1,2);
SetLevelValue(0,0);
SetLevelValue(1,10);
SetLevelValue(2,20);
SetLevelValue(3,-10);
SetLevelValue(4,-20);
return(0);
}
//******************************************************************int start()
{
int cbi=Bars-IndicatorCounted()-1; if (cbi<0) return(-1);
if (cbi==1) cbi--;
if (cbi>1) {cbi=Bars-37; n=0; ti=Time[cbi];}
//-------------------------------------------------for(int i=cbi; i>=0; i--)
{
if (ti!=Time[i]) {n++; ti=Time[i];}
ao = iAO(NULL,0,i);
ao1 = iAO(NULL,0,i+1);
if (ao>ao1) {if (fs==2) n=1; fs=1;} elseif (ao<ao1) {if (fs==1) n=1; fs=2;}
if (fs==1) {fx1[i]=n; fx2[i]=0;} elseif (fs==2) {fx2[i]=-n; fx1[i]=0;}
}
return(0);
}
//******************************************************************
Could you please tell me why the compiler thinks that in the code below
the int Ticket variable is undefined.
It generates one error
'Ticket' - variable not defined C:\Program Files\Alpari NZ MT4(2)\experts\hhhh.mq4 (18, 6)
int start()
{
double Price=iOpen (Symbol (),0,0);
double SL=NormalizeDouble (Price-3000*Point, Digits);
double TP=NormalizeDouble (Price+100*Point, Digits);
#include <OMASS.mq4> //объявление и инициализация массиваdouble value = Bid ;// параметру value функции ArrayBsearch присваивается значение текущей ценыint S = ArrayBsearch( massiv[43], value, WHOLE_ARRAY, 0, MODE_ASCEND) //функция ищет самое близкое к текущей цене значениеif (MathAbs(NormalizeDouble(Bid - S,Digits))<=0.5*Point//если текущая цена отличается от значени возвращенного функцией не более чем 0,5 п.if (Bid==Price )
int Ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,SL,TP,"jfh",123 );//открыть ордер
}
But the Ticket variable is also defined in the assignment statement in the code below and the code compiles successfully
int start()
{
double Price=iOpen (Symbol (),0,0);
double SL=NormalizeDouble (Price-3000*Point, Digits);
double TP=NormalizeDouble (Price+100*Point, Digits);
if (Bid==Price )
int Ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,SL,TP,"jfh",123 );
Спасибо.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The essence of the question is that I need to count the number of bars in each continuous block of the bar diagram of the top indicator. I wrote such an indicator (the lowest). In it, the value of each bar chart column corresponds to the number of bars in a continuous block of the top indicator, but it starts displaying ONLY since its installation (the red vertical line).I want it to be displayed on the previous bars (like when you install AO or CCI), i.e. the "picture" was similar to the middle indicator (it is the same indicator, but installed even earlier). I will listen to any suggestions with gratitude (preferably with code snippets).
The essence of the question is that I need to count the number of bars in each continuous block of the bar diagram of the top indicator. I wrote such an indicator (the lowest). In it, the value of each bar chart column corresponds to the number of bars in a continuous block of the top indicator, but it starts displaying ONLY since its installation (the red vertical line).But I need it to be displayed on previous bars also (like when you install AO or CCI), i.e. the "picture" was similar to the middle indicator (it is the same as lower indicator, but it was installed even earlier).
Something like this?
-
Something like this?
-
Thank you so much! Just what you need!
int start()
{
double Sl =Low[1];
double Tpb =((High[1]-Open[1])/Tp)+Open;
double bar2b;
if (Open[2]<Close[2])bar2b=(High[2]-Open[2];
double bar1b;
if(Open[1]<Close[1])bar1b=(High[1]-Open[1]);
if(bar2b<bar1b)OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Sl,Tpb,",16384,0,Green);
help!!!
simple moving average indicator
how to apply it in an EA to: Previous Indicators Data
iMA(NULL,0,8,0,MODE_EMA,PRICE_PREVIOUS,0);
Spam. Enough of a separate branch
It is better to write a lot of words than just help "this is a higher life credo I guess".
Gentlemen! Good evening!
Could you please tell me why the compiler thinks that in the code below
the int Ticket variable is undefined.
It generates one error
'Ticket' - variable not defined C:\Program Files\Alpari NZ MT4(2)\experts\hhhh.mq4 (18, 6)
But the Ticket variable is also defined in the assignment statement in the code below and the code compiles successfully
Gentlemen! Good evening!
Could you please tell me why the compiler thinks that in the code below
the int Ticket variable is undefined.
It generates one error
'Ticket' - variable not defined C:\Program Files\Alpari NZ MT4(2)\experts\hhhh.mq4 (18, 6)
But the Ticket variable is also defined in the assignment statement in the code below and the code compiles successfully
Probably just missing parentheses in one place