Qualsiasi domanda da principiante, per non ingombrare il forum. Professionisti, non passate oltre. Da nessuna parte senza di te - 6. - pagina 488

 
Ci sono due indicatori Ind_1 e Ind_GV. L'indicatore Ind_GV differisce da Ind_1 in quanto riceve uno dei valori di impostazione dalla variabile globale del terminale client.
Quando le impostazioni Ind_1 e Ind_GV corrispondono, Ind_GV ha un valore di risultato leggermente diverso da Ind_1.
Se metto in pausa il tester mentre Ind_1 e Ind_GV sono abbinati e compilo Ind_GV, il valore risultante di entrambi gli indicatori corrisponde completamente.
Chissà come si può spiegare questo?
 

Puoi dirmi se ho bisogno di qualche codice nell'Expert Advisor per funzionare nello strategy tester in modalità ottimizzazione?

Sto cercando di ottimizzare il mio Expert Advisor, ma non so cosa sia:


2014.02.18 21:54:30.386 Tester: trovato il file cache "C:\...\tester\caches\test.NZDUSD5.0" e può essere usato per ulteriori ottimizzazioni

2014.02.18 21:54:30.388 TestGenerator: trovato il file di tick effettivo "C:\...\tester\history\NZDUSD5_0.fxt

Abbiamo una storia. Il file NZDUSD5_0.fxt pesa circa 150 metri.

Si può anche vedere questo nei log del tester

2014.02.18 22:50:21.251 TestGenerator: errore dati non abbinati (limite di volume 305 al 2014.02.12 13:35 superato)

Di cosa si tratta?


 

Aiuto per favore!

Ognuna delle variabili può prendere un valore da 1 a 5...Dimmi come non scrivere 3125 opzioni)))

   if  (Kx==5&&     K>T &&     K>SA &&     K>SB &&     K>Bid &&
        Tx==4&&     T<K &&     T>SA &&     T>SB &&     T>Bid && 
        SAx==3&&    SA<K &&    SA<T &&     SA>SB &&    SA>Bid &&
        SBx==2&&    SB<K &&    SB<T &&     SB<SA &&    SB>Bid &&
        BID==1&&    Bid<K &&   Bid<T &&    Bid<SA &&   Bid<SB
       )
 
niktron:

Aiuto per favore!

Ognuna delle variabili può prendere un valore da 1 a 5...Dimmi come non scrivere 3125 opzioni)))

Sorteggiate 25 scelte e poi fate i conti con chi è più grande.
 
tara:
Sorteggiate 25 opzioni e poi fate i conti con chi è più grande dopo.

Grazie... è quello che sto facendo ora... volevo farlo con gli array, ma non ho la trazione...))
 
Alla fine ci sono 3125 opzioni, non 25...ma anche dividerlo in 25 opzioni è una cosa)))
 
Scrivete subito i vostri commenti, vi aiuteranno in seguito.
 
Andato da una donna.
 

Si prega di aiutare con l'indicatore con allegati ".mqh".

I buffer degli indicatori ExtBuffer1[], ExtBuffer2[] e Buffer_M[] hanno dimensione 0. Allo stesso tempo il buffer ExtBuffer0[] funziona bene e la sua dimensione è uguale a Bars, come dovrebbe essere. La cosa più interessante è che funzionava bene nella vecchia versione di MT4 prima che fosse aggiornata alla nuova. Un'altra cosa. Se sposto tutti gli elementi di un indicatore nello stesso file mq4 di base, tutto funziona di nuovo bene.

Domanda: Perché le dimensioni dell'array per i buffer degli indicatori negli allegati vengono resettate a 0?

Ecco il codice sorgente dell'indicatore.

//+------------------------------------------------------------------+

//| AO_EMA_(with_includes).mq4 |

//+------------------------------------------------------------------+

#include <AO_EMA_(with_includes)_GLOB.mqh>

//--------------------------------------------

int init()

{

#include <AO_EMA_(with_includes)_INIT.mqh>

return(0);

}

//--------------------------------------------

int start()

{

#include <AO_EMA_(with_includes)_START.mqh>

return(0);

}

//+------------------------------------------------------------------+





//+------------------------------------------------------------------+

//| AO_EMA_(with_includes)_GLOB.mq4 |

//+------------------------------------------------------------------+

#property indicator_separate_window

#property indicator_buffers 4

#property indicator_color1 Black

#property indicator_color2 Green

#property indicator_color3 Red


//---- Input Data

extern int Slow = 100;

extern double Slow_Fast = 4.318;

extern int Average = 25; // Усреднение АО

extern bool Show_AO_G = true,

Show_AO_R = true;


//---- Глобальные переменные

int Fast;

bool Alert_done = false; // Флаг говорит о том, что Alert уже был раз сгенерирован.

//---- indicator buffers

double ExtBuffer0[];

double ExtBuffer1[];

double ExtBuffer2[];

//---- Буфера индикатора, для промежуточных расчетов

double Buffer_M[];

//+------------------------------------------------------------------+

//| AO_EMA_(with_includes)_INIT.mq4 |

//+------------------------------------------------------------------+

//---- Установка значение для переменной "Fast"

Fast = NormalizeDouble(Slow / Slow_Fast, 0);


//---- indicator buffers mapping

SetIndexBuffer(0, ExtBuffer0);

SetIndexBuffer(1, ExtBuffer1);

SetIndexBuffer(2, ExtBuffer2);

SetIndexBuffer(3, Buffer_M);


//---- drawing settings

SetIndexStyle(0, DRAW_NONE); // Линия не рисуется

SetIndexStyle(1, DRAW_HISTOGRAM); // Гистограмма

SetIndexStyle(2, DRAW_HISTOGRAM); // Гистограмма

SetIndexStyle(3, DRAW_NONE); // Линия не рисуется

//---- drawing begin settings

SetIndexDrawBegin(0, Fast); // Индикатор начинает рисоваться с этого бара, от начала графика слева.

SetIndexDrawBegin(1, Fast);

SetIndexDrawBegin(2, Slow);

SetIndexDrawBegin(3, Slow);


IndicatorDigits(Digits+1);

//---- name for DataWindow and indicator subwindow label

IndicatorShortName("AO_EMA ("+Fast+"-"+Slow+")");

SetIndexLabel(1,"Green");

SetIndexLabel(2,"Red");

//---- Обнуляем буфер индикатора

SetIndexEmptyValue(0, 0.0); SetIndexEmptyValue(1, 0.0);

SetIndexEmptyValue(2, 0.0); SetIndexEmptyValue(3, 0.0);

//---- initialization done

//+------------------------------------------------------------------+

//| AO_EMA_(with_includes)_START.mq4 |

//+------------------------------------------------------------------+

int limit, pos;

int counted_bars=IndicatorCounted();

double prev,current, pr;

bool up;


//---- Последний посчитанный бар будет пересчитан

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

Print("counted_bars=",counted_bars," Bars=",Bars," limit=",limit);

Print("0=",ArraySize(ExtBuffer0)," 1=",ArraySize(ExtBuffer1)," 2=",ArraySize(ExtBuffer2)," M=",ArraySize(Buffer_M));


//---- Расчет MACD для Гистограммы "= EMA(fast) - EMA(slow)"

if(Show_AO_G == true || Show_AO_R == true)

{ for(int i=0; i<limit; i++)

Buffer_M[i]=iMA(NULL,0,Fast,0,MODE_EMA,PRICE_MEDIAN,i)-iMA(NULL,0,Slow,0,MODE_EMA,PRICE_MEDIAN,i);


//---- Усредняем MACD по "Average".Это и будет рисоваться на графике..

//---- ... можно заменить на " EMA(Fast)".

pr=2.0/(Average+1);

pos=Bars-2;

if(counted_bars>2) pos=Bars-counted_bars-1;

//---- Основной расчет

while(pos>=0)

{ if(pos==Bars-2) ExtBuffer0[pos+1]=Buffer_M[pos+1];

ExtBuffer0[pos]=Buffer_M[pos]*pr+ExtBuffer0[pos+1]*(1-pr);

pos--; }

//---- Расперделение данных между 2-я буферами, для разделения по цветам

for(i=limit-1; i>=0; i--)

{ // При перерасчете самого левого бара, порядковый номер в массиве [i+1] выходит за пределы размера массива, поэтому расчет первого цикла прорускаем.

if(i == Bars-1) continue;

//------------------------------------

current = ExtBuffer0[i];

prev = ExtBuffer0[i+1];

if(current == prev) continue;

else

{ if(current>prev) up=true;

if(current<prev) up=false;

if(!up)

{ ExtBuffer2[i]=current;

ExtBuffer1[i]=0.0; }

else

{ ExtBuffer1[i]=current;

ExtBuffer2[i]=0.0; }

}}}

//--- Устанавливаем видимость индикаторов

if(Show_AO_G == false) SetIndexStyle(1, DRAW_NONE);

if(Show_AO_R == false) SetIndexStyle(2, DRAW_NONE);

 
NEP:

Si prega di aiutare con l'indicatore con allegati ".mqh".

I buffer degli indicatori ExtBuffer1[], ExtBuffer2[] e Buffer_M[] hanno dimensione 0. Allo stesso tempo il buffer ExtBuffer0[] funziona bene e la sua dimensione è uguale a Bars, come dovrebbe essere. La cosa più interessante è che funzionava bene nella vecchia versione di MT4 prima che fosse aggiornata alla nuova. Un'altra cosa. Se sposto tutti gli elementi di un indicatore nello stesso file mq4 di base, tutto funziona di nuovo bene.

Domanda: Perché le dimensioni dell'array per i buffer degli indicatori negli allegati vengono resettate a 0?

Ecco il codice sorgente dell'indicatore.




Ti piace fare le cose nel culo?