[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 615

 
ALex2008:
So, instead of PERIOD_M1, etc., you can just put an integer number corresponding to the period? Specifically, instead of iOpen(NULL,PERIOD_M1,1, can iOpen(NULL,1,1 ?

Yes, you got it right.
 
FAQ:
Almost there. Thank you!
 
Fox_RM:
Almost there. Thank you!


What do you mean "almost" ? We don't need that, we need absolute success :)

 
Can you suggest a good advisor?
 
kuk:
What is a good councillor?

Who prints his own dough and brings coffee to bed...

And always advises ...

Under the President of All Russia... DDD


Self-written EA is the best (if you can make it that way)

 

Guys, please tell me how to pull day_max, day_min values from an indicator. It's clear that iCustom, but how? I.e. the owl has such an indicator inserted in it.

here's the header...

#property copyright "DOC"
#property link "none"


#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Green
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double day_max;
double day_min;

 
DOCTORS:

Guys, please tell me how to pull day_max, day_min values from an indicator. It's clear that iCustom, but how? I.e. the owl has such an indicator inserted in it.

Here's the header...

#property copyright "DOC"
#property link "none"


#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Green
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double day_max;
double day_min;


Why bother pulling them out, when it would be much easier to calculate in the EA.

The more so because you can only take indicator buffers from the indicator

 
Vinin:


And why take them out when it is easier to calculate them in the EA.

Especially since you can only take the indicator buffers from the indicator


Well, at least show the indicator buffers... :( I'm just confused in this moment, if in the board to search for max/min of the previous day. I.e. in my indicator it's easy - so loop, but my owl gets stuck...+ problem with counting from current bar (because I can use owl at any time) to the last bar of previous day (to calculate maxes). Maybe you can tell me how to get from the current bar to the last bar of the previous day? at least the formula for 30 min, i.e. I want to see the algorithm...
 
DOCTORS:

Well, at least show the indicator buffers ...:( I just stumped in the moment, if the advice to prescribe a search for max/min of the previous day. I.e. in my indicator it's easy - so loop, but my owl gets stuck...+ problem with counting from current bar (because the owl can be triggered at any time) to the last bar of the previous day (to calculate maxes). Maybe you can tell me how to get from the current bar to the last bar of the previous day? at least the formula for 30 min, i.e. I want to see the algorithm...


iHigh(NULL, PERIOD_D1,1) - yesterday's high

iLow(NULL, PERIOD_D1,1) - yesterday's minimum

iOpen(NULL, PERIOD_D1,1) - yesterday's opening

iClose(NULL, PERIOD_D1,1) - yesterday's close

 

Vinin:



iHigh(NULL, PERIOD_D1,1) - yesterday's high

iLow(NULL, PERIOD_D1,1) - yesterday's low

iOpen(NULL, PERIOD_D1,1) - yesterday's opening

iClose(NULL, PERIOD_D1,1) - yesterday's closing


I apologise for my lack of correctness in relation to my requests... The bottom line is that the calculation on the highs of different timeframes is different, this is understandable, hence I did the following (necessary for a strategy of trading on different timeframes):

double ExtMapBuffer1[];

double day_max;

......

int start()

{

int counted_bars = IndicatorCounted();

int limit;
//---- последний посчитанный бар будет пересчитан

if((counted_bars > 0))

counted_bars--;
limit = Bars - counted_bars;
//---- основной цикл

for(int i = 1; i < limit; i++)
{int k,z,t,b,l,n;

k=TimeHour(Time[i]);
z=TimeMinute(Time[i]);
t=Period();

if (t==60){b=24; //значение b определяет количество баров для дня на таймфрейме.
l=24*Period()*60; //l используется для доп. значений, тут не актуально
}


if (t==30){b=48;
l=48*Period()*60;
}

....

....

if (Close[iHighest(NULL,0,MODE_CLOSE,b,i)]> Open[iHighest(NULL,0,MODE_OPEN,b,i)])
{

ExtMapBuffer1[i] = Close[iHighest(NULL,0,MODE_CLOSE,b,i)];
day_max=Close[iHighest(NULL,0,MODE_CLOSE,b,i)];//сделал для того, что значение ExtMapBuffer1[i] при выводе на экран почему-то 0, тогда как day_max показыает правильно...
..... //тут графика

}

else if (Close[iHighest(NULL,0,MODE_CLOSE,b,i)]<= Open[iHighest(NULL,0,MODE_OPEN,b,i)])
{ExtMapBuffer1[i] = Open[iHighest(NULL,0,MODE_OPEN,b,i)];
day_max= Open[iHighest(NULL,0,MODE_OPEN,b,i)];

//опять графика

}

....}

Reason: