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

 

Question why are text labels not displayed in the indicator window?

// -- Процедура
void SetText(string name, string Vl, datetime t1, double p1, color c)
 {
 // if (ObjectFind(name)!=-1) ObjectDelete(name);
  ObjectCreate(name,OBJ_TEXT,WindowFind("Awesome_super_volumes"),0,0,0,0);
  ObjectSetText(name, Vl, 10, "Times New Roman", c);
  ObjectSet(name, OBJPROP_TIME1 , t1);
  ObjectSet(name, OBJPROP_PRICE1, p1);
  ObjectSet(name, OBJPROP_COLOR, c); 
  }
// -- Обращение
SetText("Awesome_super_volumes", DoubleToStr(VLUP,0), tmhgh, dist, Black);

https://www.mql5.com/ru/forum/142582/page325 06.05.2013 17:01.

 
Merincool:


And what I also thought, according to your logic the tool should calculate RSI from limit and to 0 bar, but does it make a difference which side should calculate RSI from the end or from the beginning? It should calculate RSI for each bar in a given range and put the value into a buffer (I mean in an array), and then just compare three consecutive values in an array with each other. Or is that not the case?

Yes, in my haste, I was wrong.

I hadn't noticed that you have 2 loops following each other.

Usually one cycle is used in an indicator, consequently, it is used for calculation and comparison. And if everything is realized in one cycle, it is of course, that it does not matter if the array element[i+1] is calculated or not yet :)

 
amurik61:


Explain: the meaning of "in the cycle you refer to the uncalculated values of the indicator"

I rushed the advice, see previous post.

 
Guys, tell me what's wrong with the procedure please! First post on this page.
 
Fox_RM:
Guys, tell me what's wrong with the procedure please! First post on this page.

ObjectSetText(name," Vl" , 10, "Times New Roman", c);

 
And look in the list of objects, maybe they are there, but with a crooked price , and , or time
 
How do I resuscitate the compiler? MetaEditor 4 writes that the compiler cannot be started.
 

Can you tell me why the indicator does not work in the tester?


//+------------------------------------------------------------------+
//|                                                   ProfitLine.mq4 |
//|                               Copyright © 2010, Evgeniy Trofimov |
//|                           https://www.mql5.com/ru/users/evgetrofi |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Evgeniy Trofimov"
#property link      "https://www.mql5.com/ru/users/evgetrofi"
#property indicator_chart_window
extern double Profit=0.0;
extern int MagicNumber = 0;
extern string NameBuy = "LineBuy";
extern string NameSell = "LineSell";
extern color ColorBuy = DarkBlue;
extern color ColorSell = FireBrick;
double LotsBuy, LotsSell;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() {

   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() {
   if (ObjectFind(NameBuy)!=-1) ObjectDelete(NameBuy);
   if (ObjectFind(NameSell)!=-1) ObjectDelete(NameSell);
   
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void start() {
   int    counted_bars=IndicatorCounted();
   int Window;
   double PB = ProfitPrice(Symbol(), OP_BUY, MagicNumber, Profit);
   double PS = ProfitPrice(Symbol(), OP_SELL, MagicNumber, Profit);
   //double P = (PB*LotsBuy + PS*LotsSell) / (LotsBuy+LotsSell);
   //Window=WindowFind(Shortname);
   Window=0;
   if (ObjectFind(NameBuy)==-1) ObjectCreate(NameBuy,OBJ_HLINE,Window,0,PB);
   ObjectSet(NameBuy,OBJPROP_PRICE1,PB);
   ObjectSet(NameBuy,OBJPROP_COLOR,ColorBuy);
   if (ObjectFind(NameSell)==-1) ObjectCreate(NameSell,OBJ_HLINE,Window,0,PS);
   ObjectSet(NameSell,OBJPROP_PRICE1,PS);
   ObjectSet(NameSell,OBJPROP_COLOR,ColorSell);

} //start()
//+------------------------------------------------------------------+
double ProfitPrice(string fSymbol, int fType, int fMagic=0, double MyProfit=0.0){
   //Функция возвращает цену, на которую необходимо установить уровень TakeProfit, чтобы получить прибыль MyProfit
   double SummPrice=0.0, SummLots=0.0, Formula=0.0;
   int k;
   int total = OrdersTotal();
   for (int i = total-1; i >= 0; i--) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderSymbol()==fSymbol) {
         if(OrderMagicNumber()==fMagic || fMagic==0) {
            if(OrderType()==fType) {
               k++;
               SummLots=SummLots+OrderLots();
               SummPrice=SummPrice+OrderOpenPrice()*OrderLots();
            }
         }
      }
   }//Next i  
   
   if(k>0){
      if(fType==OP_BUY){
         Formula = SummPrice/SummLots + 
         MyProfit * MarketInfo(fSymbol, MODE_POINT) / 
         (MarketInfo(fSymbol, MODE_TICKVALUE) * SummLots) +
         MarketInfo(fSymbol, MODE_SPREAD) * MarketInfo(fSymbol, MODE_POINT);
         LotsBuy = SummLots;
      } else {
         Formula = SummPrice/SummLots - 
         MyProfit * MarketInfo(fSymbol, MODE_POINT) / 
         (MarketInfo(fSymbol, MODE_TICKVALUE) * SummLots) -
         MarketInfo(fSymbol, MODE_SPREAD) * MarketInfo(fSymbol, MODE_POINT);
         LotsSell = SummLots;         
      }
   }
   
   return(Formula);
}//ProfitPrice()
//+------------------------------------------------------------------+
 
david2:

Can you tell me why the indicator does not work in the tester?




Why should it work in the tester?
 
valeryk:

ObjectSetText(name," Vl" , 10, "Times New Roman", c);


The quotes didn't help.