Questions from Beginners MQL5 MT5 MetaTrader 5 - page 407

 
first_may:

Good afternoon.

Can you please tell me how to get the value ofTenkan andKijun on the previous candle in mql5?

Please see the example foriIchimoku.
 
Karputov Vladimir:
Please look at the example foriIchimoku.

I was looking before I asked the question. In mql4 it was easier, for example on the last candlestick

double tenkan_sen=iIchimoku(NULL,0,9,26,52,MODE_TENKANSEN,1);

And here I understood that an object is created

handle=iIchimoku(name,period,tenkan_sen,kijun_sen,senkou_span_b);

But how to get the tenkan value out of it, I can't figure out :(. I want a simple tenkan and kijun intersection to track and that's it.

 
first_may:

I was looking before I asked the question. In mql4 it was easier, for example on the last candlestick

double tenkan_sen=iIchimoku(NULL,0,9,26,52,MODE_TENKANSEN,1);

And here I understood that an object is created

handle=iIchimoku(name,period,tenkan_sen,kijun_sen,senkou_span_b);

But how to get the tenkan value out of it, I can't figure out :(. I want a simple intersection of tenkan and kijun and that's it.

Do you want to track in an indicator or in an EA?
 
Karputov Vladimir:
Do you want to track in an indicator or in an EA?
In the EA. Output the alerts form with sound.
 
first_may:
In the advisor. Alerts form output with sound.
Look at the CopyBuffer() function.
 
Tapochun:
Look at function CopyBuffer().

In the example

ma_handle=iMA(Symbol(),0,period,shift,smootMode,price); - object is created

if(CopyBuffer(ma_handle,0,0,to_copy,MABuffer)<=0)return(0); - fills arrayMABuffer with values ofma_handle

And nowwe can get values fromMABuffer?

 
first_may:

In the example

ma_handle=iMA(Symbol(),0,period,shift,smootMode,price); - object is created

if(CopyBuffer(ma_handle,0,0,to_copy,MABuffer)<=0)return(0); - fills arrayMABuffer with values ofma_handle

And nowwe can get values fromMABuffer?

Yes. In MABuffer, using the function CopyBuffer() you get the values of MA on the specified interval. MABuffer is of course an array.

 
Tapochun:

Yes. In MABuffer you got the MA values on the interval you specified with the CopyBuffer() function. MABuffer, of course, is an array.

And you should do it all correctly in the procedure

intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime&time[],
constdouble&open[],
constdouble&high[],
constdouble&low[],
constdouble&close[],
constlong&tick_volume[],
constlong&volume[],

constint&spread[])

Even if I want to display the value on the screen?

 
Standard string length is from 0 to 255 characters. I read string from file line by line via FileReadString without length parameter ( length=0 by default ) .That is, the string is read from the current position to the line feed character "\r\n". What to do in case a line in a file takes more than 255 characters (and it's possible quite often). I don't want to break the string into parts, because the strings are strictly structured (the file contains html code). The idea is that first I read the whole file line by line into the array, and then only parse it and extract the information I need. If the lines split, parser will stop working, because signs of needed information may separate and get into different read lines. No long string( Any other ideas?
 
first_may:

And this is all properly done in a procedure

intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime&time[],
constdouble&open[],
constdouble&high[],
constdouble&low[],
constdouble&close[],
constlong&tick_volume[],
constlong&volume[],

constint&spread[])

Even if I want to display the value on the screen?

It all depends on logic of the indicator. Most often, yes, in OnCalculate() function.