Can someone kindly tell me how to write the following thing.
I made a training indicator, which counts iVolume for each tick: iVolume is positive for those that moved up, and negative iVolume for those that moved down. To make a curve, all iVolume (positive and negative) I add increasing total from bar to bar. A curve is obtained. However, I encountered two problems:
1) the line turns out very broken;
2) it is impossible to test the Expert Advisor, because the obtained iVolume chart has only a real life.
Question:
1) how to describe the code that allows to build a chart based on averaged data that I write in the buffer?
2) Is it possible to write the data of this indicator (that is received in the real mode) to a certain file, so that later, referring to this file, we could build the indicator on the historical data, applying the already collected tick volumes to them? If possible, how to describe it programmatically? Or is there another solution that does not require writing current iVolume information to a file?
#property version"1.00"#property strict#property indicator_separate_window#property indicator_buffers2#property indicator_label1"Вверх"#property indicator_type1DRAW_LINE#property indicator_color1 Salmon
#property indicator_style1STYLE_SOLID#property indicator_width12#property indicator_label2"Вниз"#property indicator_type2DRAW_LINE#property indicator_color2clrDarkTurquoise#property indicator_style2STYLE_SOLID#property indicator_width22datetime Время=0; // Время прошлого бараdouble Bid1;
double Buf_1[];
long V1; // объем для текущего тика вверхlong V2; // накопленный объем для всех тиков вверх текущего бараlong V3; // объем текущего тика внизlong V4; // накопленный объем для всех тиков вниз для текущего бараlong V5; // отрицательные и положительные iVolume нарастающим итогомvoidOnInit()
{
IndicatorDigits(0);
SetIndexBuffer(0,Buf_1);
//SetIndexBuffer(1,Buf_2);
Bid1=Bid;
V5 = 0;
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
datetime Вр=Time[0]; // Время текущего бараif(Вр>Время) // Если новый бар
{
Время=Вр; // Запомнить// Buf_1[0]=0; // и обнулить последний элемент буфера
}
if(Bid >= Bid1)
{
if(Bid > Bid1)
{
V1 = iVolume(NULL, 0, 0); // если повышающий цену тик
V2 = V1 + V2;
}
else
{
V1 = 0; // если Bid1 = Bid2, т.е. изменение цены = 0, то iVolume этого тика присваиваем 0;
V2 = V1 + V2;
}
}
else
{
V3 = iVolume(NULL, 0, 0); // если понижающий цену тик
V4 = V3 + V4;
}
V5 = V2-V4;
Bid1=Bid;
Buf_1[0]= V5; // в буфер сгружаем return(rates_total);
}
YarTrade: is it possible to write the data of this indicator (which is obtained in real mode) to a file, so that later, referring to this file, it would be possible to build an indicator on historical data, applying to it the already collected tick volumes? If possible, how to describe it programmatically? Or there is another solution that does not require writing the current iVolume information to the file?
Indicator based on data from file - entered this line in search and found
Hello all. Folks, could you please give us a little help? Could someone please set a line in the indicator where you can specify the name of the sound file, so that the line is displayed in the indicator settings.
Can someone kindly tell me how to write the following thing.
I made a training indicator, which counts iVolume for each tick: iVolume is positive for those that moved up, and negative iVolume for those that moved down. To make a curve, all iVolume (positive and negative) I add increasing total from bar to bar. A curve is obtained. However, I encountered two problems:
1) the line turns out very broken;
2) it is impossible to test the Expert Advisor, because the obtained iVolume chart has only a real life.
Question:
1) how to describe the code that allows to build a chart based on averaged data that I write in the buffer?
2) Is it possible to write the data of this indicator (that is received in the real mode) to a certain file, so that later, referring to this file, we could build the indicator on the historical data, applying the already collected tick volumes to them? If possible, how to describe it programmatically? Or is there another solution that does not require writing current iVolume information to a file?
Maybe add at the end of the code:
double macurrent=iMAOnArray(Buf_1[0],0,5,0,MODE_LWMA,0);
Eh, no! The compiler generates the error saying there is no array.
Anyone....., can you help? My dead end for me is set out here:https://www.mql5.com/ru/forum/160683/page378#comment_6053255
Indicator based on data from file - entered this line in search and found
Some kind of nightmare, I don't understand why it gives out like this:
Code section :
line[0]=MathFloor(Low[1]*MathPow(10,D-1));
Print("Var ",DoubleToStr(line[0],D));
Print("Code ",DoubleToStr(MathFloor(Low[1]*MathPow(10,D-1)),D));
Output :
EURUSD,M15: Var 0.00000
EURUSD,M15: Code 11754.00000
What happens to the value after assignment?
line[0]=MathFloor(Low[1]*MathPow(10,D-1));
Print("Var ",DoubleToStr(line[0],D));
Print("Code ",DoubleToStr(MathFloor(Low[1]*MathPow(10,D-1)),D));
Print :
EURUSD,M15: Var 0.00000
EURUSD,M15: Code 11754.00000
What happens to the value after assignment?
Print the value of the variables after the assignment and the value of variable D. Use your calculator to do the math.
Hello all. Folks, could you please give us a little help? Could someone please set a line in the indicator where you can specify the name of the sound file, so that the line is displayed in the indicator settings.
Print out the values of the variables after assignment and the value of variable D. Let's calculate it on a calculator...
So I print out the value of the variable after the assignment. So the code is basically the following:
a=b;
Print (a);
Print (b);
But a equals zero and b is printed correctly
This is how I output the value being assigned. So the code is essentially as follows:
a=b;
Print (a);
Print (b);
But a equals zero while b is printed correctly
I do not see zero, you have made a mistake somewhere