Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1892
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
More advice, please.
I have transferred the EA to mt5, everything seems to be working. I have written a custom indicator on mt4 to check the correctness of the execution, I am also moving it to mt5.
I have adapted the indicator, it seems it works too, but not very well.
1) it does not work deleting objects from the chart when uninstalling. I think there is no place to make a mistake.
int OnInit()
{
ObjectCreate(0, "GBP_S0",OBJ_LABEL,0,0,0);
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason);
{
ObjectDelete(0, "GBP_S0");
}
2)
If we do it this way:
ExtGBPBuffer[i]=GBPTP;
ObjectSetString(0, "GBP_S101",OBJPROP_TEXT,ExtGBPBuffer[i]);
Then the value GBP_S101 is exactly what we're looking for. But the line is zero. How can this be? I.e. the line is drawn and everything is fine, colour, width, everything except values.
Even if I do it this wayExtGBPBuffer[i]=2; the line is still 0
1) Deleting objects from the graph when uninstalling doesn't work. There seems to be nowhere to go wrong.
It works
Guys, advise on mql4 custom indicator built on MA based on opening prices, it doesn't change its readings with new ticks coming, that's why it is based on opening prices.
On mql5 the adapted indicator changes its readings in the transition zone with every tick... Also by opening prices, even like this
copy=CopyBuffer(MA2EURJPY,0,1,CountBars,MA2EURJPY_TF);
if(copy<0)
Print("Copy failed MA2EURJPY_MAS");
to take a second reading, but it still ticks back and forth
It works
I have a feeling that the language is glitchy. When I edit an unrelated fragment in mql5, everything stops working...
I have a feeling that the language is glitchy as hell. When I edit an unrelated section in mql5, everything stops working... I've had such situations too, but every time I find out "it wasn't the babina", so it's not the babina, so it's not the mql4.
I also had similar situations, but every time it turned out that "it wasn't the babina", so...
Can you give me a hint?
In mql4 there was an indicator based on MA on the opening price, it allowed to avoid re-rendering on the current bar. through int start() it worked fine. It showed everything clearly.
In mql5, the same indicator doesn't work through int start, it works through int OnCalculate. It keeps re-calculating and re-drawing, for a second the image disappears and may have different values because of the boundary situation with the intersection of two MAs, although the distance between two MAs is set, it does not help. I thought I would take not the 0th value but the 1st one from the MA buffer, but it didn't work and I also thought I would skip this function before a new bar arrives and it didn't work either (I even tried to stop displaying anything). How to overcome this situation?
When flipping the chart right to left, also flickers indicator with constant recalculation
Can you give me a hint?
In mql4 there was an indicator based on MA for opening price, it allowed to avoid re-rendering on the current bar. through int start() it worked fine. It showed everything clearly.
In mql5, the same indicator doesn't work through int start, it works through int OnCalculate. It keeps re-calculating and re-drawing, for a second the image disappears and may have different values because of the boundary situation with the intersection of two MAs, although the distance between two MAs is set, it does not help. I thought I would take not the 0th value but the 1st one from the MA buffer, but it didn't work and I also thought I would skip this function before a new bar arrives and it didn't work either (I even tried to stop displaying anything). How to overcome this situation?
When flipping the chart from right to left, also flickers indicator with constant recalculation
Ask the question here - they will definitely help.
Can you give me a hint?
In mql4 there was an indicator based on MA on the opening price, it allowed to avoid re-rendering on the current bar. through int start() it worked fine. It showed everything clearly.
In mql5, the same indicator doesn't work through int start, it works through int OnCalculate. It keeps re-calculating and re-drawing, for a second the image disappears and may have different values because of the boundary situation with the intersection of two MAs, although the distance between two MAs is set, it does not help. I thought I would take not the 0th value but the 1st one from the MA buffer, but it didn't work and I also thought I would skip this function before a new bar arrives and it didn't work either (I even tried to stop displaying anything). How to overcome this situation?
When flipping the chart right to left, also flickers indicator with constant recalculation
There is such a thing on the graphic
I've seen it done in any colour, if I'm not mistaken.
How?