Indicador HeikenAshiHistogram codigo de conversión MT4 a Prorealtime
Forums › ProRealTime foro Español › Soporte ProBuilder › Indicador HeikenAshiHistogram codigo de conversión MT4 a Prorealtime
- This topic has 4 replies, 3 voices, and was last updated 1 year ago by
Jankarl.
-
-
08/09/2023 at 2:12 PM #218830
Hola Adjunto el codigo para convertir.
//+——————————————————————+
//| HeikenAshiHistogram.mq4
//| Copyright http://www.pointzero-indicator.com
//+——————————————————————+#property copyright “Copyright © Pointzero-indicator.com”
#property link “http://www.pointzero-indicator.com”#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 Teal
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 1
#define MaMetod 2//——————————-
// External variables
//——————————-
extern int AvPeriod = 5;//——————————-
// Buffers
//——————————-double FextMapBuffer1[];
double FextMapBuffer2[];
double FextMapBuffer3[];
double FextMapBuffer4[];
double FextMapBuffer5[];//+——————————————————————+
//| Custom indicator initialization function |
//|——————————————————————|
int init()
{
// Total buffers
IndicatorBuffers(5);// Visible buffers
SetIndexStyle(0,DRAW_HISTOGRAM, 0);
SetIndexBuffer(0, FextMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM, 0);
SetIndexBuffer(1, FextMapBuffer2);
SetIndexStyle(3,DRAW_LINE, 0);
SetIndexBuffer(2,FextMapBuffer3);// Internal
SetIndexBuffer(3,FextMapBuffer4);
SetIndexBuffer(4,FextMapBuffer5);// My name
IndicatorShortName(“Heiken Ashi Histogram”);
Comment(“Copyright © http://www.pointzero-indicator.com”);
return(0);
}//+——————————————————————+
//| Custom indicator deinitialization function |
//+——————————————————————+
int deinit()
{
return(0);
}//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
// Start, limit, etc..
int start = 0;
int limit;
int counted_bars = IndicatorCounted();
if(Bars<=10) return(0);// nothing else to do?
if(counted_bars < 0)
return(-1);// do not check repeated bars
limit = Bars – 1 – counted_bars;
if(counted_bars==0) limit-=1+1;// 1) Check heiken ashi for past to present
for(int pos = limit; pos >= start; pos–)
{
// Open and close
double open = iCustom(Symbol(), 0, “Heiken Ashi”, 2, pos);
double close = iCustom(Symbol(), 0, “Heiken Ashi”, 3, pos);// Median
FextMapBuffer4[pos] = (open + close) / 2;// Difference
FextMapBuffer5[pos] = MathAbs(FextMapBuffer4[pos] – FextMapBuffer4[pos+1]);// If bearish
if(open > close)
{
FextMapBuffer2[pos] = FextMapBuffer5[pos];
FextMapBuffer1[pos] = 0;// If bullish
} else {FextMapBuffer1[pos] = FextMapBuffer5[pos];
FextMapBuffer2[pos] = 0;
}
}// Apply average
for(int i=0; i < Bars; i++) FextMapBuffer3[i] = iMAOnArray(FextMapBuffer5, Bars, AvPeriod, 0, MaMetod, i);
return(0);
}El indicador se utiliza de la siguiente manera.
Se entra largo o corto cuando una de la velas cruza por encima de la media en la siguiente vela. Si es verde se entra largo y si es roja en entra en corto.
Muchas gracias de antemano
08/09/2023 at 5:50 PM #218853Publica solo en el idioma del foro en el que publicas. Por ejemplo, inglés solo en foros en inglés y español solo en foros en español (Lo moví del foro en inglés).
Gracias 🙂
09/12/2023 at 10:16 PM #22090309/13/2023 at 8:53 AM #220912Aquí está el código de este indicador con histograma suavizado Heikin Ashi:
1234567891011121314151617181920212223242526272829AvPeriod=5if barindex>AvPeriod thenxClose = (open+high+low+close)/4if BarIndex=0 THENxOpen = openxHigh = highxLow = lowelsexOpen = (xOpen[1] + xClose[1])/2endifBuffer4 = (xopen + xclose) / 2Buffer5 = abs(Buffer4-Buffer4[1])if (open>close) thenr=255g=0elser=0g=255endifonce avg = closeavg = avg[1] + (buffer5 - avg[1]) / AvPeriodendifreturn avg style(line), buffer5 style(histogram) coloured(r,g,0)09/13/2023 at 3:40 PM #220960 -
AuthorPosts
Find exclusive trading pro-tools on