[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 380

 

Good afternoon. Can you advise me please, I need the indicator to be displayed not on the whole history, but only on the edge on a given number of bars. Code:

//+------------------------------------------------------------------+
//| Индикатор арбитражной ситуации для спреда, состоящего            |
//| из 4-х инструментов                                             |
//| Copyright © 2010, leonid553, Son_Of_Earth                        |
//+------------------------------------------------------------------+
#property copyright "leonid553 & Son_Of_Earth"
#property link      "leonid553@ya.ru,sonofearth.ua@gmail.com"

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 Black
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1


extern string Symbol1.Name = "EURUSD";     // Название инструмента 1
extern bool   Symbol1.Reverse = false;     
extern string Symbol2.Name = "";           // Название инструмента 2
extern bool   Symbol2.Reverse = false;     
extern string Symbol3.Name = "";           // Название инструмента 3
extern bool   Symbol3.Reverse = false;     
extern string Symbol4.Name = "";           // Название инструмента 4
extern bool   Symbol4.Reverse = false;     

extern string  ___MISC___ = " == Прочие настройки ==========";




extern string  ___MA___   = " == Параметры МА ценовых линий ====";

extern int MA.Slow = 50;                   // Период медленной МА


// Буферы для отображения данных
double Buf1[];    // Первый инструмент
double Buf2[];    // Второй инструмент
double Buf3[];    // Третий инструмент
double Buf4[];    // Четрертый инструмент



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
  // Делаем нечувствительными к регистру ввода наименования инструментов
  Symbol1.Name=StringUpper(Symbol1.Name);
  Symbol2.Name=StringUpper(Symbol2.Name);
  Symbol3.Name=StringUpper(Symbol3.Name);
  Symbol4.Name=StringUpper(Symbol4.Name);

  // Определяем балансовые коэффициенты каждого инструмента
  kVol1=1;
  kVol2=1;
  kVol3=1;
  kVol4=1;
  
  // Задаем имена графическим объектам
  oSymb1=Symbol1.Name;
  oSymb2=Symbol2.Name;
  oSymb3=Symbol3.Name;
  oSymb4=Symbol4.Name;


  // Формируем свойства графиков индикатора
  IndicatorBuffers(4);
  
  SetIndexStyle(0,DRAW_LINE);
  SetIndexBuffer(0,Buf1);
  SetIndexLabel(0, Symbol1.Name); 

  SetIndexStyle(1,DRAW_LINE);
  SetIndexBuffer(1,Buf2);
  SetIndexLabel(1,Symbol2.Name); 

  SetIndexStyle(2,DRAW_LINE);
  SetIndexBuffer(2,Buf3);
  SetIndexLabel(2,Symbol3.Name);

  SetIndexStyle(3,DRAW_LINE);
  SetIndexBuffer(3,Buf4);
  SetIndexLabel(3,Symbol4.Name);

  soundCount=0; // Максимально к-во повторов звукового сигнала

  return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()  {
  // Удаляем все графические объекты
  DeleteObject(oSymb1);
  DeleteObject(oSymb2); 
  DeleteObject(oSymb3);
  DeleteObject(oSymb4);

  return(0);  
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  // Подсчет количества баров для построения индикатора
  int limit; int counted_bars=IndicatorCounted();
  if(counted_bars<0) return(-1);
  if(counted_bars>0) counted_bars--; 
  limit=Bars-counted_bars;
  
  // Определяем параметры окна индикатора
  wndNum=WindowFind(WindowExpertName());
  wndName=WindowExpertName()+wndNum; 


  
 
  //------------------------------------------------------------------ 
  // Отрисовка ценовых линий: рисуем и синхронизируем по наличию баров
  for(int i=0; i<limit; i++) { 
    // Первый ценовой график
    Buf1[i]= iClose(Symbol1.Name,0,i);
    // Второй ценовой график
    Buf2[i]= iClose(Symbol2.Name,0,i);
    // Третий ценовой график
    Buf3[i]= iClose(Symbol3.Name,0,i);
    // Четвертый ценовой график
    Buf4[i]= iClose(Symbol4.Name,0,i);

 
  } // Конец блока отрисовки ценовых линий

And also, how do I know the price of an instrument for a given number of bars backwards?
 
The task is to display indicator values and percentage of price change since the beginning of the day for different instruments in one window. Can it all be displayed in a window without a chart? Is it possible to display indicator values from different timeframes? I would also be very grateful for examples of something similar. Thank you!
 
Dear, if anyone has some free time, write the code for the object "Andrew's cross" (blue diagonal cross on white background) and then I just can not draw diagonal lines without reference to the rate and time, and I want it to always be in a certain place in the terminal. I want it to be in a certain place in the terminal.)
 
Arles:
Also, how can I find out the price of an instrument for a given number of bars backwards?
For example: Close[i], where i is the bar number. Returns the close price of the i bar. (This is if it is the same symbol on which the Expert Advisor is standing).
 
Sancho77:
Dear, if anyone has some free time, write the code for the object "Andrew's cross" (blue diagonal cross on white background) and then I just can not draw diagonal lines without reference to the rate and time, and I want it to always be in a certain place in the terminal. I want it to be in a certain place in the terminal.)

If you make your own font, you can do it via Object_Label
 
Vinin:

If you make your own font, you can do it via Object_Label
Sorry, this is too complicated and incomprehensible for me)
 
Sancho77:
For example: Close[i], where i is the bar number. Returns the close price of the i bar. (This is if it is the same symbol as the EA).
Exactly, but I asked a little bit wrong. I need to know the price at a given time - I set hh:mm and the date - I get the price.
 
Sancho77:
Sorry, it's too complicated and incomprehensible for me)

It's not difficult at all. If you don't want to create your own font, you can search on the internet. There are millions of free fonts. It's just going to be a pain in the ass to find the right character.

Alternatively, you could use the letter "X" upside down by 90 degrees. You have to rotate the object itself. However, you will need to find a rectangle of suitable size for the background.

If this is not suitable, I can make you a simple font for $200, and for $1000 a proper one. :-))

 
Zhunko:

It's not difficult at all. If you don't want to create your own font, you can search on the internet. There are millions of free fonts. It's just going to be a pain in the ass to find the right character.

Alternatively, you could use the letter "X" upside down by 90 degrees. You have to rotate the object itself. However, you will need to find a rectangle of suitable size for the background.

If this is not suitable, I can make you a simple font for $200, and for $1000 a proper one. :-))

Well ordering a font for one drawing is a bit expensive for me :-))I have a suitable rectangle, can you tell me how to draw an "X" slanting line? )

PS On a fresh head figure it out! Dear, thanks for the hints ! )

 
silhouette:
So, if I understand correctly, you are suggesting using several magicians corresponding to each type of signal?
Yes, that's exactly what I would do.