Errori, bug, domande - pagina 2033

 
Stanislav Korotky:

Non c'è AAPL nello screenshot. E non si controlla il codice di ritorno di SymbolSelect.


#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0
ENUM_MA_METHOD     MA_Type   = MODE_SMA;
ENUM_APPLIED_PRICE MA_Price  = PRICE_CLOSE;
int handle;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   Print(SymbolSelect("AAPL",true));
   handle = iMA("AAPL",_Period, 10,0,MA_Type,MA_Price);

   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| 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(rates_total);
}
//+------------------------------------------------------------------+

strano così Print dà falso anche se la schermata mostra che AAPL è nella panoramica del mercato
ps ho già scritto sopra: il punto è quello di eseguire su uno strumento e ottenere dati da un altro... se volevo i dati di AAPL da AAPL avrei scritto _Symbol direttamente

 
Money_Man:

strano quindi Print dà false anche se nello screenshot si può vedere che c'è un aapl nella panoramica del mercato
ps Ho già scritto sopra: l'idea è di eseguire su uno strumento e ottenere i dati da un altro. Se avessi voluto i dati AAPL da AAPL avrei scritto _Symbol


Ilnumero di conto e la password dell'investitore sono da parte vostra. Ma do il 99,9% che il simbolo "AAPL" sul server di trading semplicemente non esiste :)

 
Money_Man:
Scrivi "Apple" invece di "AAPL" come nella tua recensione di mercato
 
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0
ENUM_MA_METHOD     MA_Type   = MODE_SMA;
ENUM_APPLIED_PRICE MA_Price  = PRICE_CLOSE;
int handle;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{ 
   ResetLastError();
  SymbolSelect("AAPL",true);
   int error = GetLastError(); 
   Print(error);
   handle = iMA("AAPL",_Period, 10,0,MA_Type,MA_Price);

   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| 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(rates_total);
}
//+------------------------------------------------------------------+

quindi dà errore 4305

 
Money_Man:

Ecco come si presenta l'errore 4305


Non c'è nessun simbolo "AAPL" sul server commerciale a cui ti stai collegando. Niente affatto.

 
Комбинатор:
Scrivi "Apple" invece di "AAPL" come nella tua recensione di mercato

aaaaaaaaaca )))
è stato raggiunto((((.
mi scusi)
deve essere perché ho più di un terminale aperto

Grazie mille a tutti quelli che hanno risposto

 

Quando si crea un file di storia, MT4 tester mette TickValue=0, TickSize=0 nell'intestazione e i parametri relativi alla commissione, non capisco cosa e dove? I valori dei campi di margine sono anche riempiti o meno - è diverso per i diversi broker.

Questo è un bug o può essere la struttura dell'intestazione sbagliata? Lo dice l'aiuto sul sito. Ho scoperto che è superato e quindi uso questo.

#property strict
#property show_inputs

input string symb="AUDCHF";

#define TOSTRING(A) #A+" = "+(string)(A) struct TestHistoryHeader   {    int               version;            // 405    char              copyright[64];      // copyright    char              description[128];   // server name                                          // 196    char              symbol[12];    int               period;    int               model;              // for what modeling type was the ticks sequence generated    int               bars;               // amount of bars in history    int               fromdate;    int               todate;    int               totalTicks;    double            modelquality;       // modeling quality                                          // 240    //---- general parameters    char              currency[12];       // currency base    int               spread;    int               digits;    int               unknown1;    double            point;    int               lot_min;            // minimum lot size    int               lot_max;            // maximum lot size    int               lot_step;    int               stops_level;        // stops level value    int               gtc_pendings;       // instruction to close pending orders at the end of day                                          // 292    //---- profit calculation parameters    int               unknown2;    double            contract_size;      // contract size    double            tick_value;         // value of one tick    double            tick_size;          // size of one tick    int               profit_mode;        // profit calculation mode        { PROFIT_CALC_FOREX, PROFIT_CALC_CFD, PROFIT_CALC_FUTURES }                                          // 324    //---- swap calculation    int               swap_enable;        // enable swap    int               swap_type;          // type of swap                   { SWAP_BY_POINTS, SWAP_BY_DOLLARS, SWAP_BY_INTEREST }    int               unknown3;    double            swap_long;    double            swap_short;         // swap overnight value    int               swap_rollover3days; // three-days swap rollover                                          // 356      //---- margin calculation    int               leverage;           // leverage    int               free_margin_mode;   // free margin calculation mode   { MARGIN_DONT_USE, MARGIN_USE_ALL, MARGIN_USE_PROFIT, MARGIN_USE_LOSS }    int               margin_mode;        // margin calculation mode        { MARGIN_CALC_FOREX,MARGIN_CALC_CFD,MARGIN_CALC_FUTURES,MARGIN_CALC_CFDINDEX };    int               margin_stopout;     // margin stopout level    int               margin_stopout_mode;// stop out check mode            { MARGIN_TYPE_PERCENT, MARGIN_TYPE_CURRENCY }    double            margin_initial;     // margin requirements    double            margin_maintenance; // margin maintenance requirements    double            margin_hedged;      // margin requirements for hedged positions    double            margin_divider;     // margin divider    char              margin_currency[12];// margin currency                                          // 420      //---- commission calculation    double            comm_base;          // basic commission    int               comm_type;          // basic commission type          { COMM_TYPE_MONEY, COMM_TYPE_PIPS, COMM_TYPE_PERCENT }    int               comm_lots;          // commission per lot or per deal { COMMISSION_PER_LOT, COMMISSION_PER_DEAL }                                          // 436      //---- for internal use    int               from_bar;           // fromdate bar number    int               to_bar;             // todate bar number    int               start_period[6];    // number of bar at which the smaller period modeling started    int               set_from;           // begin date from tester settings    int               set_to;             // end date from tester settings                                          // 476    //----    int               end_of_test;    int               freeze_level;       // order's freeze level in points    int               generating_errors;    // 488      //----    int               reserved[60];   };

void OnStart() { //--- int dig=(int)MarketInfo(symb,MODE_DIGITS); TestHistoryHeader header={0}; ResetLastError(); int handle=FileOpen(symb+"1_0.fxt",FILE_READ|FILE_BIN); if(handle!=INVALID_HANDLE) { FileReadStruct(handle,header); FileClose(handle); } else {Print("Ошибка открытия файла ",GetLastError()); return;} Print(CharArrayToString(header.description)); Print(CharArrayToString(header.margin_currency)); Print(TOSTRING(header.set_from)); Print(TOSTRING((datetime)header.set_to)); Print(TOSTRING((datetime)header.end_of_test)); Print(TOSTRING(header.tick_value)," Должно быть ", TOSTRING(DoubleToStr(NormalizeDouble(SymbolInfoDouble(symb,SYMBOL_TRADE_TICK_VALUE),dig),dig))); Print(TOSTRING(header.tick_size)," Должно быть ", TOSTRING(DoubleToStr(NormalizeDouble(SymbolInfoDouble(symb,SYMBOL_TRADE_TICK_SIZE),dig),dig))); Print(TOSTRING(header.comm_base)); Print(TOSTRING(header.comm_type)); Print(TOSTRING(header.comm_lots)); Print(TOSTRING(AccountCurrency())); }

Ho segnato in giallo i luoghi problematici.

Ecco una stampa di MetaQuotes Demo

0       17:26:59.889    ReadFXTHeader AUDCHF,M1: Copyright 2001-2016, MetaQuotes Software Corp.
0       17:26:59.889    ReadFXTHeader AUDCHF,M1: AUD
0       17:26:59.889    ReadFXTHeader AUDCHF,M1: header.set_from = 0
0       17:26:59.889    ReadFXTHeader AUDCHF,M1: (datetime)header.set_to = 2017.10.09 00:00:00
0       17:26:59.889    ReadFXTHeader AUDCHF,M1: (datetime)header.end_of_test = 2017.10.11 00:00:00
0       17:26:59.890    ReadFXTHeader AUDCHF,M1: header.tick_value = 0 Должно быть DoubleToStr(NormalizeDouble(SymbolInfoDouble(AUDCHF,SYMBOL_TRADE_TICK_VALUE),5),5) = 0.86761
0       17:26:59.890    ReadFXTHeader AUDCHF,M1: header.tick_size = 0 Должно быть DoubleToStr(NormalizeDouble(SymbolInfoDouble(AUDCHF,SYMBOL_TRADE_TICK_SIZE),5),5) = 0.00001
0       17:26:59.890    ReadFXTHeader AUDCHF,M1: header.comm_base = 0
0       17:26:59.890    ReadFXTHeader AUDCHF,M1: header.comm_type = 0
0       17:26:59.890    ReadFXTHeader AUDCHF,M1: header.comm_lots = 2

0 17:26:59.890 ReadFXTHeader AUDCHF,M1: AccountCurrency() = EUR

Utilizzare la stampa Robo-Forex (suffisso ".e")

0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: RoboForex-Demo
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: AUD
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: header.set_from = 0
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: (datetime)header.set_to = 2017.10.09 00:00:00
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: (datetime)header.end_of_test = 2017.10.11 00:00:00
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: header.tick_value = 0 Должно быть DoubleToStr(NormalizeDouble(SymbolInfoDouble(AUDCHF.e,SYMBOL_TRADE_TICK_VALUE),5),5) = 1.02795
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: header.tick_size = 0 Должно быть DoubleToStr(NormalizeDouble(SymbolInfoDouble(AUDCHF.e,SYMBOL_TRADE_TICK_SIZE),5),5) = 0.00001
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: header.comm_base = -3.598220646991178 e+91
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: header.comm_type = 1064329805
0       17:34:05.417    ReadFXTHeader AUDCHF.e,M1: header.comm_lots = 2

0 17:34:05.417 ReadFXTHeader AUDCHF.e,M1: AccountCurrency() = USD

Ora ci connetteremo a qualsiasi broker.

Aumenta la storia dei simboli.

Esegui qualsiasi EA nel tester su M1 (qualsiasi intervallo di test e non c'è bisogno di aspettare il suo completamento).

Dopo il test, copiare il file storicosymb+"1_0.fxt " creato dal testernella directory MQL4/Files dalla cartella del tester

Esegui lo script su qualsiasi grafico.

Guardiamo il registro.

 

Occasionalmente c'è una riproduzione del pulsante Home sul grafico in MT5, cioè il grafico si sposta arbitrariamente all'inizio - cosa causa questo?


 
Aleksey Vyazmikin:

Il pulsante "Home" sul grafico in MT5 occasionalmente si rigioca, cioè il grafico si sposta arbitrariamente all'inizio - cosa ha causato questo?


Scavare il pulsante "Home" con un cacciavite :)

 
Kirill Belousov:

Quando si crea un file di storia, MT4 tester mette TickValue=0, TickSize=0 nell'intestazione e i parametri relativi alla commissione, non capisco cosa e dove? I valori dei campi di margine sono anche compilati, poi no - è diverso per i diversi broker.

...

Credo che il problema sia dovuto a questo strano campo:

 //---- profit calculation parameters
   int               unknown2;

Non c'era nell'originale, da dove viene?

Motivazione: