Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Maybe if you try to get the value of last closed candle ? Like
void OnTick(){ // Obter os valores mais recentes dos buffers do indicador CopyBuffer(indicadorHandle, 0, 0, 2, IndicatorValue1); CopyBuffer(indicadorHandle, 1, 0, 2, IndicatorValue2); Print("COMPRAS", IndicatorValue1[1]); Print("VENDAS", IndicatorValue2[1]);
O don't know, but, if you observe, there are some Prints in "Ontimer", and "OnCalculate". In the experts tab, these prints don't occour. But if I select my indicator to graph, the prints appears normaly
This is unlikely. There are sell and buy orders all the time. In fact, using the operator, you can check this, as the line graphs will form curves
i meant unchanged from the previous tick. Try adding the copybuffer(s) to a loop of 5. If output is less than or equal to 0, then continue the loop.
The indicator may not be responding fast enuf also. all my ea I include such a loop now, when sourcing indicator info for this same reason of 0 reply from the indicator. I am unsure if the indicators are too slow to respond, or it happens for some other reason.i meant unchanged from the previous tick. Try adding the copybuffer(s) to a loop of 5. If output is less than or equal to 0, then continue the loop.
The indicator may not be responding fast enuf also. all my ea I include such a loop now, when sourcing indicator info for this same reason of 0 reply from the indicator. I am unsure if the indicators are too slow to respond, or it happens for some other reason.ok, let me get this straight
for(i=0;i,6;i++){ CopyBuffer(indicadorHandle, 0, 0, 1, IndicatorValue1); CopyBuffer(indicadorHandle, 1, 0, 1, IndicatorValue2); }I just need add this code?
close. I think i would do somthing like this. maybe a moderator can "pipe in".
where you have the copy buffer, i would add a function call of the following function load_Buffers();
bool load_Buffers() { ArraySetAsSeries(IndicatorValue1,true); ArraySetAsSeries(IndicatorValue2,true); int i = 1, j = i - 1; for(i = 1; i <6; ++i) { ArrayResize(IndicatorValue1, 5, 5); ArrayResize(IndicatorValue2, 5, 5); if(!(CopyBuffer(indicadorHandle, 0, 0, 5, IndicatorValue1) > j)) continue; else if(!(CopyBuffer(indicadorHandle, 0, 0, 5, IndicatorValue2) > j)) continue; else return true; } return false; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello every one.
I'm iniciant in mql5, I have a indicator that I do and now I want create a EA for work with indicator. This is very simple because I am a iniciant
I'm testing this EA, but I think that the values of buffers are not actualized when I am using the EA.
If you try ut just the indicator on a graph, you will see tha indicator works fine, but if you try use the EA, the values of buffers will be 0 ever.
this the code to indicator:
and this is the code of EA: