
Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
Hola a todos
Soy nuevo en programacion y estoy que no se por donde seguir, estoy intentando dividir 2 buffers pero al hacerlo el indicador deja de funcionar, no se si el resultado es cero o hay otro problema
estaria muy agradecido por cualquier ayuda que me podais dar.
muchas gracias
#property copyright "Your copyright"
#property link "Link to your website"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color3 Red
#property indicator_width3 2
// exported variables
// local variables
string LF = "\n"; // use this in custom or utility blocks where you need line feeds
int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names
int current = 0; // variable points to current bar
double Buffer4[];
double Buffer3[];
double Buffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if (false) ObjectsDeleteAll(); // clear the chart
IndicatorShortName("Indicator name");
IndicatorDigits(Digits+1);
IndicatorBuffers(3);
SetIndexBuffer(0, Buffer4);
SetIndexBuffer(1, Buffer3);
SetIndexBuffer(2, Buffer2);
SetIndexStyle(2, DRAW_LINE, STYLE_SOLID);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
if (false) ObjectsDeleteAll();
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator start function |
//+------------------------------------------------------------------+
int start()
{
OnEveryTick1();
return(0);
}
//+------------------------------------------------------------------+
void OnEveryTick1()
{
int i;
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
i = Bars - counted_bars;
// main calculation loop
while (i >= 0)
{
current = i;
Calculation4();
Calculation3();
ChartLine2();
i--;
}
}
void Calculation4()
{
Buffer4[current]= iATR(NULL, PERIOD_CURRENT,10,current);
}
void Calculation3()
{
Buffer3[current]= iATR(NULL, PERIOD_CURRENT,30,current);
}
void ChartLine2()
{
Buffer2[current]= Buffer3[current]/ Buffer2[current];
}