[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 25

 
BARS >> :

Everybody was a dummy )))

This is actually what I have encountered. The maximal period by constants is PERIOD_MN1 or 43200.

How should I calculate the difference between Hi and Low for the current currency pair from the beginning of the quarter and year?

I'm trying to do it the dumb way, but it doesn't work...

volotil_04  = MathAbs((iHigh(NULL,1440*90,0)  - iLow(NULL,1440*90,0))   /Point);   // с начала квартала
volotil_05  = MathAbs((iHigh(NULL,1440*365,0) - iLow(NULL,1440*365,0))  /Point);   // с начала года

May be, what function should be written? Help, please...

 

Dear Sirs, I can't find a muwinking indicator with high timeframe, there is only one 'MA-4H'

But it has a disadvantage - it lacks set price types, how can I add HIGH and LOW?

 
Goalkeeper писал(а) >>

Maybe a function needs to be written? Help, please...

High[iHighest(NULL,PERIOD_MN1,MODE_HIGH,12,0)], или High[iHighest(NULL,PERIOD_D1,MODE_HIGH,365,0)]
Here's a maximum for a year, for example... I think the principle is clear.
 
Figar0 >> :
Here's an example of the maximum for a year... I think the principle is clear.

>> thank you. I'll give it a try... But it's for the previous full 12 months from the current day, right? How do I get it to be calculated from the beginning of the current year only?

 
keekkenen >> :

the value that is placed in the buffer, by which the histogram is drawn

Another question about the value the indicator will pass to the Expert Advisor through iCustom.

What if there is a condition in the indicator itself:

If one variable is larger than the other, the histogram is red, otherwise it is blue.

What value will it pass to the Expert Advisor and is there a possibility to make it pass 1 for a red histogram and -1 for a blue one?


Question #2:

I often see Return (0); and Return (-1); how it is used in practice and why I don't understand it(( please advise, please.

 
Goalkeeper писал(а) >>

Thanks... I'll give it a try... But that's for the previous full 12 months from the current day, right? How do I get it to be calculated from the beginning of the current year only?

Calculate bar number of the year beginning(iBarShift will help us) and substitute it instead of 0.

 
xruss писал(а) >>

Question #2:

I often see Return (0); and Return (-1); in code how it is used in practice and why I can't figure it out(( please advise, please.

This is a simple value returned by the function but if it is not handled you may return anything you like, just return;

 
Figar0 >> :

It's just a value returned by the function, if it's not handled, you can return anything, even just return;

I understand now. Thank you.


Could you advise on the first question: I am writing an Expert Advisor that works with the indicator (via iCustom.

The histograms are drawn in the indicator itself (as bars) and they are drawn by a condition:

If one variable (which is calculated from the bar prices) is bigger than the other, then a red histogram is drawn, otherwise a blue one.

Which value it will pass to the Expert Advisor and is there a possibility to make it pass 1 for red histogram and -1 for blue?

 
xruss >> :

If one variable (which is calculated from bar prices) is greater than the other, then it draws a red histogram, otherwise a blue one.

Which value it will pass to the Expert Advisor and Is there any way to make it send value 1 in case of red histogram and -1 in case of blue one?

You will answer your own question if you realise that each buffer being drawn has one different colour. The two-coloured line you see on the graph is actually drawn with two buffers. At times when it is red, the "red" buffer is equal to the value of the line, and the "blue" buffer is 0 (or EmptyValue). And vice versa. Consequently, you have to take two iCustom, for two buffers.

What is the logic inside the indicator, the output buffers don't give a shit. You work like with a black box.

 
Figar0 >> :

Calculate the number of the bar at the beginning of the year(iBarShift to help) and substitute it for 0.

What am I doing wrong?

   datetime d0 = StrToTime(Year()+".01.01");
   int newyear = iBarShift(NULL, PERIOD_MN1, d0);
   volotil_05  = MathAbs((High[iHighest(NULL,PERIOD_D1,MODE_HIGH,365, newyear)] - Low[iLowest(NULL,PERIOD_D1,MODE_LOW,365, newyear)])  /Point);   // с начала года