[ARCHIVIO]Qualsiasi domanda da principiante, per non ingombrare il forum. Professionisti, non passate oltre. Non posso andare da nessuna parte senza di te - 5. - pagina 328

 

Domanda: perché le etichette di testo non vengono visualizzate nella finestra dell'indicatore?

// -- Процедура
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:


E quello che ho anche pensato, secondo la tua logica lo strumento dovrebbe calcolare l'RSI dal limite e fino alla barra 0, ma ha importanza da che parte calcolare l'RSI dalla fine o dall'inizio? Dovrebbe calcolare l'RSI per ogni barra in un dato intervallo e mettere il valore in un buffer (cioè in un array), e poi semplicemente confrontare tre valori consecutivi in un array tra loro. O non è questo il caso?

Sì, nella mia fretta ho sbagliato.

Non avevo notato che hai 2 cicli che si susseguono.

Di solito un ciclo è usato in un indicatore, di conseguenza, è usato per il calcolo e il confronto. E se tutto è realizzato in un ciclo, è naturalmente, se l'elemento dell'array[i+1] è calcolato o no ancora :)

 
amurik61:


Spiegare: il significato di "nel ciclo si fa riferimento ai valori non calcolati dell'indicatore"

Ho affrettato il consiglio, vedi il post precedente.

 
Ragazzi, ditemi cosa c'è di sbagliato nella procedura, per favore! Primo post su questa pagina.
 
Fox_RM:
Ragazzi, ditemi cosa c'è di sbagliato nella procedura, per favore! Primo post su questa pagina.

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

 
E guarda nella lista degli oggetti, forse sono lì, ma con un prezzo storto, e, o tempo
 
Come posso resuscitare il compilatore? MetaEditor 4 scrive che il compilatore non può essere avviato.
 

Puoi dirmi perché l'indicatore non funziona nel 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:

Puoi dirmi perché l'indicatore non funziona nel tester?




Perché dovrebbe funzionare nel tester?
 
valeryk:

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


Le citazioni non hanno aiutato.
Motivazione: