Ajuda na codificação - página 384

 

Estou recebendo um erro/aviso quando compenso. Alguém pode tornar isto compatível com as últimas compilações do MT4... a menos que este erro não seja um grande problema.

Muito obrigado.

jbozman

Arquivos anexados:
 
jbozman:
Estou recebendo um erro/aviso quando compenso. Alguém pode tornar isto compatível com as últimas compilações do MT4... a menos que este erro não seja um grande problema.

Muito obrigado

jbozman

jbozman

Experimente agora : price_lines_jlmv_1.mq4

Arquivos anexados:
 
mladen:
jbozmanTry it out now : price_lines_jlmv_1.mq4

Sem erros. Compilado e com bom aspecto. Você é o máximo.

j

 

por favor, ajude ... se eu compilar ... não tenho erro

mas na Expert Tab metatrader têm erro

2014.11.02 15:20:17.495 array out of range in '#MTF__B.mq4' (84,25)[/PHP]

[PHP]

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

//| #MTF__B.mq4 |

//| Copyright 2014, MetaQuotes Software Corp. |

//| https://www.mql5.com |

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

#property copyright "Copyright 2014, MetaQuotes Software Corp."

#property link "https://www.mql5.com"

#property version "1.00"

#property strict

#property indicator_chart_window

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 clrDodgerBlue

#property indicator_color2 clrDeepPink

#property indicator_width1 0

#property indicator_width2 0

//---- input parameters

/*************************************************************************

PERIOD_M1 1

PERIOD_M5 5

PERIOD_M15 15

PERIOD_M30 30

PERIOD_H1 60

PERIOD_H4 240

PERIOD_D1 1440

PERIOD_W1 10080

PERIOD_MN1 43200

You must use the numeric value of the timeframe that you want to use

when you set the TimeFrame' value with the indicator inputs.

---------------------------------------

PRICE_CLOSE 0 Close price.

PRICE_OPEN 1 Open price.

PRICE_HIGH 2 High price.

PRICE_LOW 3 Low price.

PRICE_MEDIAN 4 Median price, (high+low)/2.

PRICE_TYPICAL 5 Typical price, (high+low+close)/3.

PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.

You must use the numeric value of the Applied Price that you want to use

when you set the 'applied_price' value with the indicator inputs.

**************************************************************************/

extern int TimeFrame=30;

extern int barn=1000;

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicator line

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexStyle(0,DRAW_ARROW,0,5);

SetIndexStyle(1,DRAW_ARROW,0,5);

SetIndexArrow(0,158);

SetIndexArrow(1,158);

return(0);

}

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

//| |

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

int start()

{

datetime TimeArray[];

int i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame

ArrayCopySeries(TimeArray,MODE_TIME,NULL,TimeFrame);

limit=Bars-counted_bars;

for(i=0,y=0;i<limit;i++)

{

if (Time<TimeArray[y]) y++; ///// line of error here ...

/***********************************************************

Add your main indicator loop below. You can reference an existing

indicator with its iName or iCustom.

Rule 1: Add extern inputs above for all neccesary values

Rule 2: Use 'TimeFrame' for the indicator time frame

Rule 3: Use 'y' for your indicator's shift value

**********************************************************/

ExtMapBuffer1=iCustom(NULL,TimeFrame,"indicator",1,4,0,y) ;

ExtMapBuffer2=iCustom(NULL,TimeFrame,"indicator",1,4,1,y) ;

}

//

return(0);

}

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

obrigado

 
rizkyd:
por favor, ajude ... se eu compilar ... não tenho erro

mas na Expert Tab metatrader têm erro

2014.11.02 15:20:17.495 array out of range in '#MTF__B.mq4' (84,25)[/PHP]

[PHP]

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

//| #MTF__B.mq4 |

//| Copyright 2014, MetaQuotes Software Corp. |

//| https://www.mql5.com |

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

#property copyright "Copyright 2014, MetaQuotes Software Corp."

#property link "https://www.mql5.com"

#property version "1.00"

#property strict

#property indicator_chart_window

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 clrDodgerBlue

#property indicator_color2 clrDeepPink

#property indicator_width1 0

#property indicator_width2 0

//---- input parameters

/*************************************************************************

PERIOD_M1 1

PERIOD_M5 5

PERIOD_M15 15

PERIOD_M30 30

PERIOD_H1 60

PERIOD_H4 240

PERIOD_D1 1440

PERIOD_W1 10080

PERIOD_MN1 43200

You must use the numeric value of the timeframe that you want to use

when you set the TimeFrame' value with the indicator inputs.

---------------------------------------

PRICE_CLOSE 0 Close price.

PRICE_OPEN 1 Open price.

PRICE_HIGH 2 High price.

PRICE_LOW 3 Low price.

PRICE_MEDIAN 4 Median price, (high+low)/2.

PRICE_TYPICAL 5 Typical price, (high+low+close)/3.

PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.

You must use the numeric value of the Applied Price that you want to use

when you set the 'applied_price' value with the indicator inputs.

**************************************************************************/

extern int TimeFrame=30;

extern int barn=1000;

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicator line

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexStyle(0,DRAW_ARROW,0,5);

SetIndexStyle(1,DRAW_ARROW,0,5);

SetIndexArrow(0,158);

SetIndexArrow(1,158);

return(0);

}

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

//| |

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

int start()

{

datetime TimeArray[];

int i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame

ArrayCopySeries(TimeArray,MODE_TIME,NULL,TimeFrame);

limit=MathMin(Bars-counted_bars,Bars-1);

for(i=0,y=0;i<limit;i++)

{

if (Time<TimeArray[y]) y++; ///// line of error here ...

/***********************************************************

Add your main indicator loop below. You can reference an existing

indicator with its iName or iCustom.

Rule 1: Add extern inputs above for all neccesary values

Rule 2: Use 'TimeFrame' for the indicator time frame

Rule 3: Use 'y' for your indicator's shift value

**********************************************************/

ExtMapBuffer1=iCustom(NULL,TimeFrame,"indicator",1,4,0,y) ;

ExtMapBuffer2=iCustom(NULL,TimeFrame,"indicator",1,4,1,y) ;

}

//

return(0);

}

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

obrigado

Tente substituir esta linha

limite=barras_contadas_combarras;

com este :

limit=MathMin(MathMax(Bars-counted_bars,2*TimeFrame/Period()),Bars-1);

 
mladen:
Tente substituir esta linha

limite=barras_contadas_combarras;

com este :

limit=MathMin(MathMax(Bars-counted_bars,2*TimeFrame/Period()),Bars-1);

obrigado mladen

 

Olá, Mladen,

Estou tendo problemas para codificar esta EA, pois as regras de entrada são algo que nunca fiz antes.

Por exemplo, nesta profissão, é simples escrever a regra de entrada, já que a flecha verde e vermelha aparecem ao mesmo tempo. Portanto, na abertura da próxima vela, tomamos uma posição curta.

Mas, neste próximo exemplo, eu primeiro recebo a flecha verde sem uma flecha vermelha. Portanto, não tomo o ofício até que a seta vermelha apareça. Além disso, todas as velas que estão depois daquela seta verde e antes daquela seta vermelha devem ser para cima, pois, caso contrário, esta não é uma troca válida.

Como diabos eu codifico esta regra específica? Sei como codificá-la para a vela atual, mas não sei como especificar estas condições. Qualquer ajuda seria ótima!

Arquivos anexados:
capture1.jpg  19 kb
capture.jpg  22 kb
 
Jason2005:
Olá, Mladen,

Estou tendo problemas para codificar esta EA, pois as regras de entrada são algo que nunca fiz antes.

Por exemplo, nesta profissão, é simples escrever a regra de entrada, já que a flecha verde e vermelha aparecem ao mesmo tempo. Portanto, na abertura da próxima vela, tomamos uma posição curta.

Mas, neste próximo exemplo, eu primeiro recebo a flecha verde sem uma flecha vermelha. Portanto, não tomo o ofício até que a seta vermelha apareça. Além disso, todas as velas que estão depois daquela seta verde e antes daquela seta vermelha devem ser para cima, pois, caso contrário, esta não é uma troca válida.

Como diabos eu codifico esta regra específica? Eu sei codificá-la para a vela atual, mas não sei como especificar estas condições. Qualquer ajuda seria ótima!

Jason

Por que você não copia as condições lógicas do código que está criando essas setas?

 
mladen:
JasonPor que você não copia as condições lógicas do código que está criando essas flechas?

Não tenho bem a certeza se entendo o que está dizendo...

O que estou tentando descobrir é como em minhas condições de compra ou venda faço a EA entender que quando a seta vermelha aparece (que é o gatilho) a condição é que deve ter havido uma seta verde antes e que todas as velas que seguem essa seta devem estar PARA CIMA ou PARA BAIXO, dependendo do que for necessário. Mas não sei quando essa flecha verde teria aparecido.

 
Jason2005:
Não tenho bem a certeza se entendo o que está dizendo... O que estou tentando descobrir é como em minhas condições de compra ou venda faço a EA entender que quando a seta vermelha aparece (que é o gatilho) a condição é que deve ter havido uma seta verde antes e que todas as velas que seguem essa seta devem estar PARA CIMA ou PARA BAIXO, dependendo do que for necessário. Mas não sei quando essa flecha verde teria aparecido.

Oi Jason2005,

As Setas Vermelha e Verde são valores nos amortecedores de seu indicador....não sua EA....

Use iCustom em sua EA para chamar seus valores indicadores nos buffers... e depois use-os para sua estratégia comercial.

Há muitos bons posts aqui neste fórum sobre como usar o iCustom em sua EA...

Entretanto...se você anexar seus indicadores aqui...alguém poderá ajudá-lo a mostrar quais buffers de indicadores você pode usar em suas declarações iCustom.

Espero que isto ajude,

Robert

Razão: