Questions from a "dummy" - page 254

 
Looked at other TFs - seems to match in principle, will do. In the upper picture the lines just did not have enough time to go down, because there are less bars, it seems to me :). That's it, thanks !
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Стили рисования
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Стили рисования
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Стили рисования - Документация по MQL5
 

Can you please tell me why levels are not drawn in the window. It's just an empty window in which I add indicators. But I need the window to have levels, and it doesn't want to

//+------------------------------------------------------------------+
//|                                                            e.mq5 |
//|                                                           Рэндом |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Рэндом"
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
#property  indicator_level1 20.0
#property  indicator_level4 80.0
#property indicator_levelcolor C'64,64,64'
#property indicator_levelwidth 1
#property indicator_levelstyle 2

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   
  }
//+------------------------------------------------------------------+
 
Agat:

Can you please tell me why levels are not drawn in the window. It's just an empty window in which I add indicators. But I need the window to have levels, and it doesn't want to

You have specified levels 1 and 4. Set 2 instead of 4.
 
Nope, doesn't help. Even if you remove all lines 5 to 11 and try to add levels manually when joining the graph, they still don't appear
 
Agat:
Nope, doesn't help. Even if you remove all lines 5 to 11 and try to add levels manually when joining the graph, they still don't appear

You must also specify the window minimum and maximum:

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_minimum 0
#property indicator_maximum 100
#property  indicator_level1 20.0
#property  indicator_level2 80.0
#property indicator_levelcolor C'64,64,64'
#property indicator_levelwidth 1
#property indicator_levelstyle 2
 
Yes, the levels have appeared, thank you. But the indicator name also appeared. The whole point is that when installing an empty window first, no inscriptions appear at all. It's probably easier to make levels on one of the added indicators
 

It's not working again. If I add lines about minimum - maximum (or manually) to the code of the required indicatorhttps://www.mql5.com/ru/code/537?source=terminal5_mql5, it is not drawn at all. It itself is not drawn to the edge of the window, that's the problem, that's why I wanted to add levels, to see where the boundary of its drawing is.

Ideally, of course, you want it to go from window edge to window edge. Is there any way to achieve this?

Индикатор Fisher Transform
Индикатор Fisher Transform
  • votes: 8
  • 2011.10.10
  • Witold Wozniak
  • www.mql5.com
Индикатор Fisher, рассчитывая минимальные и максимальные уровни цены в предыдущей истории, определяет силу и направление тренда, прогнозируя его смену.
 
Agat:

It's not working again. If I add lines about minimum - maximum (or manually) to the code of the required indicatorhttps://www.mql5.com/ru/code/537?source=terminal5_mql5, it is not drawn at all. It itself is not drawn to the edge of the window, that's the problem, that's why I wanted to add levels, to see where the boundary of its drawing is.

Ideally, of course, you want it to go from window edge to window edge. Is there any way to achieve this?

Yes. You have to monitor the events and constantly track the new maximum and minimum on the bars visible in the window. To do this, see the OnChartEvent() and IndicatorSetDouble() functions in the help, and all identifiers for them.

P.S. And ChartGetInteger().

 

Got it, thanks, I'll look into it.

What function could be used to make a script that

1). Change the background of the graph to Custom on startup;

2). When restarting on the same chart, would it change the background back to the previous one?

 
Agat:

Got it, thanks, I'll look into it.

What function could be used to make a script that

1). Change the background of the graph to Custom on startup;

2). When restarting on the same chart, would it change the background back to the previous one?

Look at the section in the Help - Operations with Charts. You can change almost all properties of the graph, not just the current one.
Reason: