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

 
EVGENII SHELIPOV #:

Makar something is wrong. Love it thank you. I found a not-so-pretty option myself, but it works.

Show me where GetAveragePriceManMaxOrders() is called.
 

MakarFX #:
Покажи где идет обращение к GetAveragePriceManMaxOrders()

 ObjectCreate(0,"AveragePriceLineMinMaxOrders0",OBJ_HLINE, 0, 0, GetAveragePriceManMaxOrders(0));
   ObjectSet("AveragePriceLineMinMaxOrders0", OBJPROP_COLOR, clrLime);
   ObjectSet("AveragePriceLineMinMaxOrders0", OBJPROP_STYLE, STYLE_DASH);
   ObjectCreate(0,"AveragePriceLineMinMaxOrders1",OBJ_HLINE, 0, 0, GetAveragePriceManMaxOrders(1));
   ObjectSet("AveragePriceLineMinMaxOrders1",OBJPROP_COLOR, clrRed);
   ObjectSet("AveragePriceLineMinMaxOrders1", OBJPROP_STYLE, STYLE_DASH);

Makar I don't have anything serious hanging on this function yet. I've just made a reference to visualise objects. This function is for the future, so to speak.

 
EVGENII SHELIPOV #:

Makar I don't have anything serious hanging on this function yet. I've just made a reference to visualise objects. This function is so to speak for the future.

Delete

ObjectCreate(0,"AveragePriceLineMinMaxOrders0",OBJ_HLINE, 0, 0, GetAveragePriceManMaxOrders(0));
   ObjectSet("AveragePriceLineMinMaxOrders0", OBJPROP_COLOR, clrLime);
   ObjectSet("AveragePriceLineMinMaxOrders0", OBJPROP_STYLE, STYLE_DASH);
   ObjectCreate(0,"AveragePriceLineMinMaxOrders1",OBJ_HLINE, 0, 0, GetAveragePriceManMaxOrders(1));
   ObjectSet("AveragePriceLineMinMaxOrders1",OBJPROP_COLOR, clrRed);
   ObjectSet("AveragePriceLineMinMaxOrders1", OBJPROP_STYLE, STYLE_DASH);

and everything should work

 

Good afternoon everyone. I have such a task in mt4. Initially, at the beginning of the day I open 30 charts of different symbols with medium term template, and on all the charts I have attached indicator and EA with its parameters. Then I analyze the charts and on the one with a signal I move from D1 to n1 and if there is a signal on n1, the Expert Advisor opens positions and it supports them. At the end of the day it turns out that a part of the chart is on the d1, and another part is on n1. At the beginning of the next day, I again need all the charts to be on d1 with indicator and EA that have saved their parameters. I have tried to save a profile at the moment when all the charts are on d1. I loading the profile, but the charts that have been switched to n1 still remain on this timeframe. Is there a ready solution to switch all open charts in the terminal easily and quickly to d1 with saving all my settings? A script, an Expert Advisor or something else?

And the second question - if I have 30 open charts and I stand on the right side of the bottom bar where all the charts are, I can switch to the right chart with one click instead of paging through one chart?


the rightmost chart out of 30. the right arrow scrolls 1 at a time - how do I go to the rightmost one?

 
DanilaMactep #:

Good afternoon everyone. I have such a task in mt4. Initially, at the beginning of the day I open 30 charts of different symbols with medium term template, and on all the charts I have attached indicator and EA with its parameters. Then I analyze the charts and on the one with a signal I move from D1 to n1 and if there is a signal on n1, the Expert Advisor opens positions and it supports them. At the end of the day it turns out that a part of the chart is on the d1, and another part is on n1. At the beginning of the next day, I again need all the charts to be on d1 with indicator and EA that have saved their parameters. I have tried to save a profile at the moment when all the charts are on d1. I loading the profile, but the charts that have been switched to n1 still remain on this timeframe. Is there a ready solution to switch all open charts in the terminal easily and quickly to d1 with saving all my settings? A script, an Expert Advisor or something else?

And the second question - if I have 30 open charts and I stand on the right in the bottom bar where all the charts are, I can switch to the right chart with one tap instead of paging through one chart.

Here is a script to help with this question:

/********************************************************************\
|                                                           Test.mq5 |
|                                            © 2021, Alexey Viktorov |
|                       https://www.mql5.com/ru/users/alexeyvik/news |
\********************************************************************/
#property copyright "Viktorov"
#property link      "https://www.mql5.com/ru/users/alexeyvik/news"
#property version   "1.00"
#property strict

/********************Script program start function*******************/
void OnStart()
 {
  long prevChart = ChartFirst();
  while(prevChart >= 0)
   {
    if(ChartPeriod(prevChart) != PERIOD_D1)
      ChartSetSymbolPeriod(prevChart, ChartSymbol(prevChart), PERIOD_D1);
    prevChart = ChartNext(prevChart);
   }
 }/******************************************************************/
/*****************************End program****************************/

In the second question, the key combination ctrl+tab or ctrl+shift+tab will help

or write a script with one line of code

ChartSetInteger(ChartFirst(), CHART_BRING_TO_TOP, 0, true)
 
Alexey Viktorov #:

Here is a script to help with this question:

In the second question, the keyboard shortcut ctrl+tab or ctrl+shift+tab will help

or write a script with one line of code

Thanks for the code - I'm going to add it to the script, I hope it works and doesn't even explode :-) ;-)
 
Alexey Viktorov #:

Here is a script to help with this question:

In the second question, the keyboard shortcut ctrl+tab or ctrl+shift+tab will help

or write a script with one line of code

All worked perfectly - thank you very much - now I will save a lot of time and effort P/S while screwing nothing burst and also for the transfer to the n1 reworked)))))))

 
Good day! I would like to ask experienced users, there is a very simple indicator, the code is attached below, I want to switch to Metatrader5 terminal and the current indicator written in mql4 does not work, are there any basic principles of triggers how to rewrite the indicator, or maybe convert it
//+--где индикатор если indicator_chart_window то на график у нас в отдельном окне
#property indicator_separate_window
//+--уровни это сколько масивов Buf0[],Buf1[],Buf2[]; у нас каждый масив это линия
#property indicator_buffers 3
//+--сколько линий и какого цвета
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Blue 
//+-- ширина линии
#property indicator_width1  2
#property indicator_width2  3
#property indicator_width3  3
//+--уровни
#property indicator_level1 30 //+--уровень 1
#property indicator_level2 50 //+--уровень 2
#property indicator_levelstyle 2 //+--тип линии уровня 2 - это пунктир
#property indicator_levelcolor Black //+-- цвет линии уровня
//+-- то что будет в окне "входные параметры"                                         
extern int RSIPERIOD=5;
extern double KOEFF1=1.4;
extern double KOEFF2=2; 
//+-- описываем какие у нас массивы (их три) и перменные (в даном случае параметры РСАЙ (D10,D11,D12;) это переменная                                                                                                                                                       
double Buf0[],Buf1[],Buf2[];
double D10,D11,D12;
//+-- Блок init ПРЕДПОЛОДЖИТЕЛЬНО описательный                                                                                                                                                                                                                                                                                                                                      
int init()
  {
   IndicatorDigits(0); //+--формат точности (количество знаков после десятичной точки) для визуализации значений индикатора в окне индикатора (цифры rsi 7 или 7,23)
   string short_name="KAVRSI";   //+-- задаем 2 строчками короткое имя        
   IndicatorShortName("KAVRSI"); //+-- задаем 2 строчками короткое имя
   
   D10=RSIPERIOD;D11=D10*KOEFF1;D12=D11*KOEFF2;; //+--тут мы высчитываем переменные которые описали как масивы выше
 
   SetIndexBuffer(0,Buf0); //+-- описываем 1 массив Buf0[] первый это нулевой второй это первый и т.д.
   SetIndexStyle (0,DRAW_LINE); //+-- говорим что этот масив хотим представить в виде линии 0 это порядковый номер линии соответствует номеру масива 
   SetIndexBuffer(1,Buf1); //+-- описываем 2 массив Buf1[]
   SetIndexStyle (1,DRAW_LINE); //+-- 1 это порядковый номер линии соответствует номеру масива Buf1[]
   SetIndexBuffer(2,Buf2);
   SetIndexStyle (2,DRAW_LINE);
   return(0);
  }
//+-- Блок start сама математика и ОТРИСОВКА                                                                                                             
int start()
  {
   if(Bars<=RSIPERIOD)return(0); //+-- начинаем задавать условия если количество баров меньше расчета (баров 9 а мы считаем по 14) то выдаем 0
   int ExtCountedBars=IndicatorCounted(); //+--Возвращает количество баров, не измененных после последнего вызова индикатора.
   //---- последний посчитанный бар будет пересчитан
   if (ExtCountedBars>0) ExtCountedBars--;
   if (ExtCountedBars<0) return(-1);
   //+-- for(int для int это переменна в нашем случае видимо int ExtCountedBars=IndicatorCounted()
   //+-- и тут мы задаем параметр i - его свойства и описание на основе пересчитаных баров 
   //+-- в нашем случае НЕТ НЕ ПЕРЕСЧИТАННЫХ - считаеться и последний! 
   for(int i=0;i<Bars-RSIPERIOD;i++)
      {
       Buf0[i] = iRSI(NULL,0,D10,0,i);//+-- говорим что 1 массив это рсай с параметром D10
//+-- Пишем в коде что бы ВМЕСТО красной и синей линией RSI2 и RSI3 была одна линия - 
//+-- чтобы вместо красной и синей была одна - мы получаем среднее значение этих линий, т.е.     
       Buf1[i] = (iRSI(NULL,0,D11,0,i)+iRSI(NULL,0,D12,0,i))/2; //+-- и у этой линии, по умолчанию, красный цвет  
//+-- когда выполняется условие
       if(iRSI(NULL,0,D11,0,i)>iRSI(NULL,0,D12,0,i))
//+-- то мы не меняем цвет линии, т.к. в МТ4 это нельзя сделать,
//+-- а берем и накладываем сверху другую линию с другим цветом      
       Buf2[i] = Buf1[i]; 
       else
       Buf2[i] = EMPTY_VALUE; //+-- добавляем else Buf2[i] = EMPTY_VALUE; EMPTY_VALUE - Пустое значение в индикаторном буфере 
      }
   return(0);
  }
 

Hello!

I'd like to hear from programmers who give advice on MQL5 for a fee!

Or maybe someone will give you a piece of advice! I would be grateful!

 
Peperoni #:

Hello!

I would like to hear from any programmers who give advice for a fee!

Or maybe someone will recommend someone. I would be grateful!

Either freelance or ask your question here.

Торговые приложения для MetaTrader 5 на заказ
Торговые приложения для MetaTrader 5 на заказ
  • 2021.11.02
  • www.mql5.com
Самый большой фриланс c разработчиками программ на MQL5
Reason: