Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1926

 
Valeriy Yastremskiy #:
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.

 
Valeriy Yastremskiy #:
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:

В настройках трал 30. Значит показать линии на уровнях, где сработают тралы, и так все 7 линий: 30-60-90-120-150-180-210, типа прогрессии.

Прошли 30 и достигли линии, трал переводит стопы на уровень цены открытия, по достижении 60, переводит стопы на +30 от цены открытия, то есть на уровень, где срабатывал первый стоп и тд.

Change the code, draw lines and nothing else.


Thank you!

 
Good afternoon. Well advise a newbie, trying to upload an expert in the market. Gives error "Error! Wrong type of file uploaded, .....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!
 
Vycheslav Vyrikov #:
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().

Документация по MQL5: Обработка событий / OnStart
Документация по MQL5: Обработка событий / OnStart
  • www.mql5.com
OnStart - Обработка событий - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Vitaly Muzichenko #:

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

 
Artyom Trishkin #:

Dig towards the standard handlers.

I'm sure you have start() there, not OnStart().

Artyom you are already tired and have started to make inaccuracies yourself. For the expert that Vyacheslav is trying to load, the event handling function should be OnTick()
 
Alexey Viktorov #:
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()

Документация по MQL5: Обработка событий / OnTick
Документация по MQL5: Обработка событий / OnTick
  • www.mql5.com
OnTick - Обработка событий - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

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?

 
Andrey Sokolov #:

The day is not at all kind.

Are these files present at the addresses given?

Yes they are

Reason: