Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1926
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
7 parameters is not an option) 7 names of horizontal lines in the parameters that it will draw and name. And we should proceed from them. And if the parameters, the range of price movement and the number of levels. Calculate and draw. Well, when the level triggers, it should draw the sl line and if the sl coincides with the price level, it should change its colour.
You kind of need an algorithm that draws lines at the calculated prices.
When all the positions are closed, they should be deleted.
7 parameters is not an option) 7 names of horizontal lines in the parameters it will draw and name. And we should dance from them. If parameters, the range of price movement and the number of levels. Calculate and draw. Well, when the level triggers, it should draw the sl line and if the sl coincides with the price level, it should change its colour.
Clarification:
Change the code, draw lines and nothing else.
Thank you!
Your product category - Experts, the correct program type for it - Expert" But it is an Expert! Where do I dig? I`ve been struggling for 2 days!
Afternoon. Well, can you advise a newbie, I am trying to upload an Expert Advisor to the market. Gives error "Error! Wrong file type loaded, .....ex4 - Script.
Your product category - Experts, the correct program type for it - Expert" But it is an Expert! Where do I dig? I`ve been struggling for 2 days!
Dig towards the standard handlers.
I'm sure you have start() there, not OnStart().
You kind of need an algorithm that draws lines at the calculated prices.
When all positions are closed, they should be deleted.
double sumLots[2]=0,weight[2]=0;
for(int pos=OrdersTotal()-1;pos>=0;pos--) {
if (! OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)) continue;
// тут всякие прочии фильтры
DrawOrderLevels(); // нарисовать уровни куда может перекатиться стоп-лосс конкретного ордера
// расчёт общих позиций
int type=OrderType();
sumLots[type]+=OrderLots();
weight[type]+=OrderLots()*OrderOpenPrice();
}
double avg[3]; // общии позиции
if (sumLots[OP_BUY]!=0) avg[OP_BUY]=weight[OP_BUY]/sumLots[OP_BUY];
if (sumLots[OP_SELL]!=0) avg[OP_SELL]=weight[OP_SELL]/sumLots[OP_SELL];
// совокупная позиция
int posType; // тип
double posPrice; // цена
double posLots; // объём
if (sumLots[OP_BUY]>sumLots[OP_SELL) { posType=OP_BUY; posPrice=avg[OP_BUY]; posLots=sumLots[OP_BUY]-sumLots[OP_SELL]; }
else { posType=OP_SELL; posPrice=avg[OP_SELL]; posLots=sumLots[OP_SELL]-sumLots[OP_BUY]; }
DrawPriceLevels(OP_BUY,avg[OP_BUY]); // нарисовать уровни суммарной позы в BUY
DrawPriceLevels(OP_SELL,avg[OP_SELL]); // нарисовать уровни суммарной позы в SELL
DrawPriceLevels(posType,posPrice); // уровни общей позиции
In the names of horizontal levels add the ticket number. Sometimes (when necessary) to check - if the ticket is not in the market, then all levels with its name should be removed
Dig towards the standard handlers.
I'm sure you have start() there, not OnStart().
Artyom, you got tired and started making inaccuracies yourself. For the Expert Advisor that Vyacheslav is trying to load, the event handling function should be OnTick()
Yes, you're right. My mistake. Of course it was about OnTick()
Good afternoon. Today after the restart of MT 4 some Expert Advisors stopped installing to the trading window, all with the same error
3 10:30:19.094 cannot load 'C:\Users\ ...................\AppData\Roaming\MetaQuotes\Terminal\A36AF210AC069FB7936B0CA5BC2668BF\MQL4\Experts\Market\Silver Power EA.ex4'
Good afternoon. Today after the restart of MT 4 some Expert Advisors stopped installing to the trading window, all with the same error
3 10:30:19.094 cannot load 'C:\Users\ ...................\AppData\Roaming\MetaQuotes\Terminal\A36AF210AC069FB7936B0CA5BC2668BF\MQL4\Experts\Market\Silver Power EA.ex4'
This is not a good day at all.
Are these files present at the above addresses?
The day is not at all kind.
Are these files present at the addresses given?
Yes they are