Dear All Coder
please modifie my indicator
what i want is
1. Elliminate double fractal ( 1 up fractal 1 vs down fractal each side)
2. dot length is 2x (Up to Down fractal distance)
thanks before
Code: Select all
//+------------------------------------------------------------------+
//| 3 Fractals.mq4 |
//| Copyright © 2020 |
//| Sultan's_Channel |
//| anto.mulyanto@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Anto.mulyanto"
#property link "anto.mulyanto@gmail.com"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Aqua
//---- buffers
double FUp[];
double FDn[];
double ZZ[];
double val1;
double val2;
int i;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexArrow(0, 159);
SetIndexArrow(1, 159);
//----
SetIndexStyle(0, DRAW_ARROW, STYLE_DOT, 1);
SetIndexDrawBegin(0, i);
SetIndexBuffer(0, FUp);
SetIndexLabel(0,"Atas");
//----
SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1);
SetIndexDrawBegin(1,i);
SetIndexBuffer(1, FDn);
SetIndexLabel(1,"Bawah");
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
i = Bars;
while( i >= 0)
{
val1 = High[i] < High[i+1] && High[i+1] > High[i+2];
//----
if(val1 > 0 )
FUp[i+1] = High[i+1];
else if(val2 == 0 )
FUp[i+1] = FUp[i+2];
val2 = Low[i] > Low[i+1] && Low[i+1] < Low[i+2];
//----
if(val2 > 0 )
FDn[i+1] = Low[i+1];
else if(val1 == 0 )
FDn[i+1] = FDn[i+2];
i--;
}
return(0);
}
//+------------------------------------------------------------------+