[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 182

 
hoz:

Ho scritto un semplice indicatore. Ecco il codice:

C'è solo un buffer in esso. I valori degli indicatori sono di tipo doppio.

In Expert Advisor, ho deciso di ottenere il valore dell'indicatore e applicarlo al trade come filtro.

Qui ho scritto una semplice chiamata di funzione di questo indicatore buffer sull'ultima barra formata:

Nel tester il valore della pendenza viene restituito sbagliato:

Perché? Il tipo è corretto. Anche la chiamata è corretta. L'indicatore funziona correttamente a tutti. Ecco il log sul tester, e dal mercato attuale reale:

Perché viene restituitosempre un numero2147483647 invece del numero richiesto?

Viene restituito un valore vuoto(EMPTY_VALUE), che è 2147483647. Forse dovresti premere Ctrl+D e cercare i dati dell'indicatore stesso?
 
hoz:

Ho scritto un semplice indicatore. Ecco il codice:

Ha solo un buffer. I valori degli indicatori sono di tipo doppio.

In Expert Advisor, ho deciso di ottenere il valore dell'indicatore e applicarlo al trade come filtro.

Qui ho scritto una semplice chiamata di funzione di questo indicatore buffer sull'ultima barra formata:

Il valore della pendenza non è corretto nel tester:

Perché? Il tipo è corretto. Anche la chiamata è corretta. L'indicatore funziona correttamente a tutti. Ecco il log sul tester, e dal mercato attuale reale:

Perché viene restituitosempre un numero2147483647 invece del numero richiesto?


Rielaborato l'indicatore

2013.02.26 21:22:39     2011.12.30 23:59  D_Aleks_first_pattern EURUSD,H1: slope = -0.0003
2013.02.26 21:22:39     2011.12.30 23:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0003
2013.02.26 21:22:39     2011.12.30 22:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0006
2013.02.26 21:22:39     2011.12.30 21:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0009
2013.02.26 21:22:39     2011.12.30 20:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0011
2013.02.26 21:22:39     2011.12.30 19:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 18:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 17:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0014
2013.02.26 21:22:39     2011.12.30 16:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 15:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 14:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 13:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 12:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 11:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 10:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.30 09:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 08:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 07:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 06:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 05:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0011
2013.02.26 21:22:39     2011.12.30 04:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 03:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 02:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 01:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.30 00:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 23:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 22:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0014
2013.02.26 21:22:39     2011.12.29 21:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0015
2013.02.26 21:22:39     2011.12.29 20:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0017
2013.02.26 21:22:39     2011.12.29 19:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0018
2013.02.26 21:22:39     2011.12.29 18:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0018
2013.02.26 21:22:39     2011.12.29 17:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0017
2013.02.26 21:22:39     2011.12.29 16:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0016
2013.02.26 21:22:39     2011.12.29 15:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0015
2013.02.26 21:22:39     2011.12.29 14:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0015
2013.02.26 21:22:39     2011.12.29 13:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0014
2013.02.26 21:22:39     2011.12.29 12:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0014
2013.02.26 21:22:39     2011.12.29 11:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0014
2013.02.26 21:22:39     2011.12.29 10:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 09:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 08:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 07:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 06:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 05:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 04:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 03:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 02:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 01:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.29 00:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0013
2013.02.26 21:22:39     2011.12.28 23:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0012
2013.02.26 21:22:39     2011.12.28 22:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.001
2013.02.26 21:22:39     2011.12.28 21:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0007
2013.02.26 21:22:39     2011.12.28 20:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0004
2013.02.26 21:22:39     2011.12.28 19:00  D_Aleks_first_pattern EURUSD,H1: slope = -0.0002
2013.02.26 21:22:39     2011.12.28 18:00  D_Aleks_first_pattern EURUSD,H1: slope = 0
2013.02.26 21:22:39     2011.12.28 17:00  D_Aleks_first_pattern EURUSD,H1: slope = 0
2013.02.26 21:22:39     2011.12.28 16:00  D_Aleks_first_pattern EURUSD,H1: slope = 0.0001
2013.02.26 21:22:39     2011.12.28 15:00  D_Aleks_first_pattern EURUSD,H1: slope = 0.0001
2013.02.26 21:22:39     2011.12.28 14:00  D_Aleks_first_pattern EURUSD,H1: slope = 0.0001
2013.02.26 21:22:39     2011.12.28 13:00  D_Aleks_first_pattern EURUSD,H1: slope = 0.0001
2013.02.26 21:22:39     2011.12.28 12:00  D_Aleks_first_pattern EURUSD,H1: slope = 0.0001
2013.02.26 21:22:39     2011.12.28 11:00  D_Aleks_first_pattern EURUSD,H1: slope = 0.0002
2013.02.26 21:22:39     2011.12.28 10:00  D_Aleks_first_pattern EURUSD,H1: slope = 0.0002
File:
 
Vinin:


Il problema sembra essere con l'indicatore.


Hai ragione... Ma è solo il numero di barre che deve essere ricalcolato... Strano perché non c'è modo di ottenere il valore corretto in questo caso.

Se si commenta questa linea, tutto funziona bene e si corregge il calcolo dalla 0a barra:

int start()
  {
    int i, countedBars = IndicatorCounted();
    int limit = Bars - countedBars - 1;
    //if (limit > 400) limit = 400;
        
    for(i = limit;i > 0;i--)
    {

Ma Nella variante precedente, al priming emetteva un valore adeguato. Ma il gufo non prende adeguato. Perché?

 
hoz:


Hai ragione... Ma è solo il numero di barre da ricalcolare... Strano perché in questo caso non c'è modo di ottenere il valore corretto.

Se questa linea viene commentata, tutto funziona bene e il calcolo dalla barra 0 viene corretto:

Ma Nella variante precedente, emetteva un valore adeguato. Ma il gufo non prende adeguato. Perché?


Sembra che tu stia usando la modalità di visualizzazione per controllare
 
Vinin:

Sembra che tu stia usando la modalità di visualizzazione per controllare

Sì, e allora?
 

Aiutatemi a trovare un bug, nessuna azione e nessun errore. Forse mi manca qualche libreria?

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
#import "kernel32.dll"
   int _lopen  (string path, int of);
   int _lcreat (string path, int attrib);
   int _llseek (int handle, int offset, int origin);
   int _lread  (int handle, string buffer, int bytes);
   int _lwrite (int handle, string buffer, int bytes);
   int _lclose (int handle);
#import


int start()
 {
 string text ="222222";//текст который собираемся записать или перезаписать в файл
 string pach ="D:\FILE.txt";//путь куда записываем файл или перезаписываем
 WriteFile("D:\FILE.txt", text);//выполнение 
 }
//+------------------------------------------------------------------+
//|  записать содержимое буфера по указанному пути                   |
//+------------------------------------------------------------------+
void WriteFile (string path, string buffer) 
 {
  int count=StringLen(buffer); //Возвращает число символов в строке. 
  int result;
  int handle=_lopen (path,1);
  if(handle<0) //если файл еще не создан то создаем
  {
  handle=_lcreat (path,0);
  result=_lclose (handle);
  }
  handle=_lopen (path,1);     //открываем          
  result=_llseek (handle,0,0);    //ставим указатель      
  result=_lwrite (handle,buffer,count); //записываем
  result=_lclose (handle);       //закрываем файл       
 }
//+------------------------------------------------------------------+  

Il mio sistema: MT4, Build 451.

Windows 7 Home Base.

 
merkulov.artem:

Aiutatemi a trovare un bug, nessuna azione e nessun errore. Forse mi manca qualche libreria?

Il mio sistema: MT4, Build 451.

Windows 7 Home Base.

Stampe la maniglia e il risultato dopo ogni operazione, saprete cosa non funziona
 
Cosa c'è di sbagliato nelle funzioni standard di FileXXXXX?
 
come scegliere il lotto più piccolo tra tutti gli scambi aperti?
 
pasha5282:
come scegliere il lotto più piccolo tra tutti gli scambi aperti?


int i, ot = OrdersTotal();
double min=0;
int min_ticket=0;
for(i=0;i<ot;i++)
{
   if(!OrderSelect(i,SELECT_BY_POS)) continue;
   if(OrderType()!=OP_BUY && OrderType()!=OP_SELL) continue;
   if(i==0||min> OrderLots()) {min = OrderLots(); min_ticket=OrderTicket();}
}