I'm trying to create a fractal dash board by calling and existing fractal indi - however having problems returning the colors.
Any one can tell me what I'm doing wrong?
Am I passing the wrong values as the variables in the dashboard indi is exactly like the variable in fractal indi.
Re: Coding help please
2I'm trying to get buffer 3 and 4 since these are the fractals i want to pull into my indicator - can anyone tell me what i'm doing wrong.
Code seems to work when I pull arrows from other indicators but when it comes to fractals it doesn't want to work. Any help...
The variables in my indi is declared exactly like it is in the fractal indi.
code in fractal indicator
calling buffers
Code seems to work when I pull arrows from other indicators but when it comes to fractals it doesn't want to work. Any help...
The variables in my indi is declared exactly like it is in the fractal indi.
code in fractal indicator
Code: Select all
#property indicator_chart_window
#property indicator_buffers 5
//------
#property indicator_color1 clrOrangeRed //DarkOrange
#property indicator_color2 clrDodgerBlue //DeepSkyBlue
#property indicator_color3 clrSlateGray //LightSteelBlue
//------
#property indicator_width1 0
#property indicator_width2 0
#property indicator_width3 0
//------
#property indicator_style1 STYLE_DOT
#property indicator_style2 STYLE_DOT
#property indicator_style3 STYLE_DOT //ASH
//**************************************************************************//
//*** Custom indicator ENUM settings ***
//**************************************************************************//
enum showBND { BandsOFF, bCENTER, bBANDS, bFULL };
//+++======================================================================+++
//+++ Custom indicator input parameters +++
//+++======================================================================+++
extern int History = 4444; //1234;
extern ENUM_TIMEFRAMES HLTimeFrame = PERIOD_CURRENT;
extern int HLPeriod = 12; //5; = оригинальный Fractals Вильямса...
extern double HLDivider = 2.0;
extern color FRUpper = clrRed, //Magenta; //FireBrick, //Orange
FRLower = clrLime; //White, //LightCyan, //Lavender, //DarkGreen;
extern int FRGap = 0, //Дистанция от High/Low свечи (4-значные пипсы)
FRCodUP = 217, //233, //225 //241 //171,
FRCodLO = 218, //234, //226 //242 //171,
FRSize = 2;
extern showBND ShowBands = bFULL;
extern bool BandsLikeHL = true;
extern ENUM_TIMEFRAMES BDTimeFrame = PERIOD_CURRENT;
extern int BDPeriod = 36; //5; = оригинальный Fractals Вильямса...
extern double BDDivider = 1.5;
extern int BandsGap = 0;
extern int BandsShift = 0;
extern string SoundFile = "alert2.wav"; //"expert.wav"; //"stops.wav" //"news.wav"; //
extern int SIGNALBAR = 1; //На каком баре сигналить....
extern bool AlertsMessage = true, //false,
AlertsSound = true, //false,
AlertsEmail = false,
AlertsMobile = false;
//+++======================================================================+++
//+++ Custom indicator buffers +++
//+++======================================================================+++
double SUPP[], RESS[], MIDD[], FracUP[], FracLO[];
double GAP, BGAP; int MAX, HLDV, BDDV, SGB; datetime TimeBar=0;
//+++======================================================================+++
//+++ Custom indicator initialization function +++
//+++======================================================================+++
int init()
{
HLTimeFrame = fmax(HLTimeFrame,_Period);
HLPeriod = fmax(HLPeriod,3);
HLDivider = fmax(HLDivider,1.001);
HLDV = floor(HLPeriod/HLDivider);
//------
if (BandsLikeHL) {
BDTimeFrame = HLTimeFrame;
BDPeriod = HLPeriod;
BDDivider = HLDivider;
BDDV = HLDV; }
else {
BDTimeFrame = fmax(BDTimeFrame,_Period);
BDPeriod = fmax(BDPeriod,3);
BDDivider = fmax(BDDivider,1.001);
BDDV = floor(BDPeriod/BDDivider); }
//------
MAX = fmax(HLPeriod,BDPeriod);
//------
GAP=FRGap*_Point; if (Digits==3 || Digits==5) GAP*=10;
BGAP=BandsGap*_Point; if (Digits==3 || Digits==5) BGAP*=10;
SGB=SIGNALBAR; //+HLPeriod/2;
//------ additional buffers are used for counting
IndicatorBuffers(5); IndicatorDigits(Digits); if (Digits==3 || Digits==5) IndicatorDigits(Digits-1);
//------ 2 indicator buffers mapping
int BDLT = (ShowBands==0 || ShowBands==1) ? DRAW_NONE : DRAW_LINE;
SetIndexBuffer(0,RESS); SetIndexStyle(0,BDLT); SetIndexShift(0,BDTimeFrame/_Period*BandsShift);
SetIndexBuffer(1,SUPP); SetIndexStyle(1,BDLT); SetIndexShift(1,BDTimeFrame/_Period*BandsShift);
int MDLT = (ShowBands==0 || ShowBands==2) ? DRAW_NONE : DRAW_LINE;
SetIndexBuffer(2,MIDD); SetIndexStyle(2,MDLT); SetIndexShift(2,BDTimeFrame/_Period*BandsShift);
//------
SetIndexBuffer(3,FracUP); //SetIndexEmptyValue(0,0.0);
SetIndexBuffer(4,FracLO); //SetIndexEmptyValue(1,0.0);
//------
for (int i=0; i<indicator_buffers; i++) {
//SetIndexStyle(i,DRAW_ARROW,EMPTY,MXSize,MXClrUP); //--- настройка параметров отрисовки
SetIndexEmptyValue(i,0.0); //--- значение 0 отображаться не будет
//SetIndexShift(11,SlowShift); //--- установка сдвига линий при отрисовке
if (History > MAX) SetIndexDrawBegin(i,Bars-History); //--- пропуск отрисовки первых баров
if (History <= MAX) SetIndexDrawBegin(i,MAX); }
//------ drawing settings
int Tup = (FRUpper!=clrNONE && FRCodUP>32) ? DRAW_ARROW : DRAW_NONE;
SetIndexStyle(3,Tup,EMPTY,FRSize,FRUpper); SetIndexArrow(3,FRCodUP);
int Tlo = (FRLower!=clrNONE && FRCodLO>32) ? DRAW_ARROW : DRAW_NONE;
SetIndexStyle(4,Tlo,EMPTY,FRSize,FRLower); SetIndexArrow(4,FRCodLO);
//------ labels setup
if (ShowBands!=0) SetIndexLabel(0,stringMTF(BDTimeFrame)+": Band HI +"+(string)BandsGap+ " +"+(string)BandsShift); else SetIndexLabel(0,NULL);
if (ShowBands!=0) SetIndexLabel(1,stringMTF(BDTimeFrame)+": Band LO -"+(string)BandsGap+ " +"+(string)BandsShift); else SetIndexLabel(1,NULL);
if (ShowBands!=0) SetIndexLabel(2,stringMTF(BDTimeFrame)+": MidLine ["+(string)BDPeriod+ "/"+DoubleToStr(BDDivider,2)+"]"); else SetIndexLabel(2,NULL);
//------
SetIndexLabel(3,stringMTF(HLTimeFrame)+": Fractal UPPER ["+(string)HLPeriod+ "/"+DoubleToStr(HLDivider,2)+"]");
SetIndexLabel(4,stringMTF(HLTimeFrame)+": Fractal LOWER ["+(string)HLPeriod+ "/"+DoubleToStr(HLDivider,2)+"]");
//------ name for DataWindow and indicator subwindow label
Code: Select all
double fracup = iCustom(TradePair[i],TradePeriodTF[j],"fractfordash",History,HLTimeFrame,HLPeriod,HLDivider,FRUpper,FRLower,FRGap,FRCodUP,FRCodLO,FRSize,ShowBands,BandsLikeHL,BDTimeFrame,BDPeriod,BDDivider,BandsGap,BandsShift,SoundFile,SIGNALBAR,AlertsMessage,AlertsSound,AlertsEmail,AlertsMobile,3,0);
double fracdn = iCustom(TradePair[i],TradePeriodTF[j],"fractfordash",History,HLTimeFrame,HLPeriod,HLDivider,FRUpper,FRLower,FRGap,FRCodUP,FRCodLO,FRSize,ShowBands,BandsLikeHL,BDTimeFrame,BDPeriod,BDDivider,BandsGap,BandsShift,SoundFile,SIGNALBAR,AlertsMessage,AlertsSound,AlertsEmail,AlertsMobile,4,0);