Hi guys, i need some help if someoane it is there!
I want to use in my indicator the last 3 buffers bar from the fractals indicator, example: Fractals Indicator, has '' SetIndexBuffer(0,ExtUpFractalsBuffer);''
so i want to use the last 3 value of this ' ExtUpFractalsBuffer'' and the same for ''ExtDownFractalsBuffer' !
There is a thread all about iCustom(), find it, read it, understand it . . .
I try it to use that but now i thenk i did not make something right because my mt4 platform crach down.! Enyway i will insist if you say that is the direction! So thnak's RaptorUK!
I try it to use that but now i thenk i did not make something right because my mt4 platform crach down.! Enyway i will insist if you say that is the direction! So thnak's RaptorUK!
And i thenk it is not possibile to use iCustom() in the same indicator code, because that is what i whant to do!
Ok, i will remake my text, i want to use in Fractals indicator, to add some code and to use the last 3 value of SetIndexBuffer(0,ExtUpFractalsBuffer), i repeat in the same indicator i want to add code, not in some EA or another indicator!
Thank's!
SetIndexBuffer(1,ExtDownFractalsBuffer);
SetIndexBuffer(2,UpRatio);
SetIndexBuffer(3,DownRatio);
SetIndexBuffer(4,UpValue);
SetIndexBuffer(5,DownValue); .........................until here is ok
double dRatio;
double dUpValue;
............................................................................................all this ok
dRatio=((High[i]+Low[i]+Open[i]+Close[i])/4); .........this is working
dUpValue=(((UpRatio[0]+UpRatio[1]+UpRatio[2])/3) *1.008); ..........................................THIS IT IS NOT WORK
UpRatio[i]=dRatio; ...with this is ok
UpValue[0]=dUpValue; .....................................................................NOT WORK
Play videoPlease edit your post.
For large amounts of code, attach it.- There are no mind readers here. "NOT WORK" is meaningless. What does it do? what are the values? What do you think it should do?
- There are no mind readers here. Post ALL the code, we have no idea whither your code is in init or in start() what your loop is etc.
#property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 White #property indicator_color4 Blue #property indicator_color5 Green #property indicator_color6 Red //---- input parameters //---- buffers double ExtUpFractalsBuffer[]; double ExtDownFractalsBuffer[]; double UpRatio[]; double DownRatio[]; double UpValue[]; double DownValue[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(Buffer_Count); IndicatorShortName("Fractals"); //---- indicator buffers mapping SetIndexBuffer(0,ExtUpFractalsBuffer); SetIndexBuffer(1,ExtDownFractalsBuffer); SetIndexBuffer(2,UpRatio); SetIndexBuffer(3,DownRatio); SetIndexBuffer(4,UpValue); SetIndexBuffer(5,DownValue); //---- drawing settings SetIndexArrow(0,119); SetIndexStyle(0,0); SetIndexArrow(1,119); SetIndexStyle(1,0); SetIndexArrow(2,219); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(3,219); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(4,219); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,219); //---- SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); SetIndexEmptyValue(2,0.0); SetIndexEmptyValue(3,0.0); SetIndexEmptyValue(4,0.0); SetIndexEmptyValue(5,0.0); //---- name for DataWindow SetIndexLabel(0,"Fractal Up"); SetIndexLabel(1,"Fractal Down"); SetIndexLabel(2,"Up Ratio"); SetIndexLabel(3,"Down Ratio"); SetIndexLabel(4,"Up Value"); SetIndexLabel(5,"Down Value"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,nCountedBars; bool bFound; double dCurrent; double dRatio; double dUpValue; double dDownValue; nCountedBars=IndicatorCounted(); //---- last counted bar will be recounted if(nCountedBars<=2) i=Bars-nCountedBars-3; if(nCountedBars>2) { nCountedBars--; i=Bars-nCountedBars-1; } //----Up and Down Fractals while(i>=2) { //----Fractals up bFound=false; dCurrent=High[i]; dRatio=((High[i]+Low[i]+Open[i]+Close[i])/4); dUpValue=((((UpRatio[0])+(UpRatio[1])+(UpRatio[2]))/3)*1.008); if(dCurrent>High[i+1] && dCurrent>High[i+2] && dCurrent>High[i-1] && dCurrent>High[i-2]) { bFound=true; ExtUpFractalsBuffer[i]=dCurrent; UpRatio[i]=dRatio; UpValue[0]=dUpValue; } //----6 bars Fractal if(!bFound && (Bars-i-1)>=3) { if(dCurrent==High[i+1] && dCurrent>High[i+2] && dCurrent>High[i+3] && dCurrent>High[i-1] && dCurrent>High[i-2]) { bFound=true; ExtUpFractalsBuffer[i]=dCurrent; UpRatio[i]=dRatio; UpValue[0]=dUpValue; } } //----7 bars Fractal if(!bFound && (Bars-i-1)>=4) { if(dCurrent>=High[i+1] && dCurrent==High[i+2] && dCurrent>High[i+3] && dCurrent>High[i+4] && dCurrent>High[i-1] && dCurrent>High[i-2]) { bFound=true; ExtUpFractalsBuffer[i]=dCurrent; UpRatio[i]=dRatio; UpValue[i]=dUpValue; } } //----8 bars Fractal if(!bFound && (Bars-i-1)>=5) { if(dCurrent>=High[i+1] && dCurrent==High[i+2] && dCurrent==High[i+3] && dCurrent>High[i+4] && dCurrent>High[i+5] && dCurrent>High[i-1] && dCurrent>High[i-2]) { bFound=true; ExtUpFractalsBuffer[i]=dCurrent; UpRatio[i]=dRatio; UpValue[0]=dUpValue; } } //----9 bars Fractal if(!bFound && (Bars-i-1)>=6) { if(dCurrent>=High[i+1] && dCurrent==High[i+2] && dCurrent>=High[i+3] && dCurrent==High[i+4] && dCurrent>High[i+5] && dCurrent>High[i+6] && dCurrent>High[i-1] && dCurrent>High[i-2]) { bFound=true; ExtUpFractalsBuffer[i]=dCurrent; UpRatio[i]=dRatio; UpValue[0]=dUpValue; } } //----Fractals down bFound=false; dCurrent=Low[i]; dRatio=((High[i]+Low[i]+Open[i]+Close[i])/4); dDownValue=(((DownRatio[0]+DownRatio[1]+DownRatio[2])/3)*1.008); if(dCurrent<Low[i+1] && dCurrent<Low[i+2] && dCurrent<Low[i-1] && dCurrent<Low[i-2]) { bFound=true; ExtDownFractalsBuffer[i]=dCurrent; DownRatio[i]=dRatio; DownValue[0]=dDownValue; } //----6 bars Fractal if(!bFound && (Bars-i-1)>=3) { if(dCurrent==Low[i+1] && dCurrent<Low[i+2] && dCurrent<Low[i+3] && dCurrent<Low[i-1] && dCurrent<Low[i-2]) { bFound=true; ExtDownFractalsBuffer[i]=dCurrent; DownRatio[i]=dRatio; DownValue[0]=dDownValue; } } //----7 bars Fractal if(!bFound && (Bars-i-1)>=4) { if(dCurrent<=Low[i+1] && dCurrent==Low[i+2] && dCurrent<Low[i+3] && dCurrent<Low[i+4] && dCurrent<Low[i-1] && dCurrent<Low[i-2]) { bFound=true; ExtDownFractalsBuffer[i]=dCurrent; DownRatio[i]=dRatio; DownValue[0]=dDownValue; } } //----8 bars Fractal if(!bFound && (Bars-i-1)>=5) { if(dCurrent<=Low[i+1] && dCurrent==Low[i+2] && dCurrent==Low[i+3] && dCurrent<Low[i+4] && dCurrent<Low[i+5] && dCurrent<Low[i-1] && dCurrent<Low[i-2]) { bFound=true; ExtDownFractalsBuffer[i]=dCurrent; DownRatio[i]=dRatio; DownValue[0]=dDownValue; } } //----9 bars Fractal if(!bFound && (Bars-i-1)>=6) { if(dCurrent<=Low[i+1] && dCurrent==Low[i+2] && dCurrent<=Low[i+3] && dCurrent==Low[i+4] && dCurrent<Low[i+5] && dCurrent<Low[i+6] && dCurrent<Low[i-1] && dCurrent<Low[i-2]) { bFound=true; ExtDownFractalsBuffer[i]=dCurrent; DownRatio[i]=dRatio; DownValue[0]=dDownValue; } } i--; } //---- return(0); } //+------------------------------------------------------------------+
In this code, the buffer 0 and 1 it working but not displayng on the chart because i want to do so, buffers 2 and 3 is working and displayng on chart and that is ok, the problem is for buffers 4 and 5 the code of them is not make the matematic calcul and not display on chart!
Thank you very much for your help!
I wait for answers!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys, i need some help if someoane it is there!
I want to use in my indicator the last 3 buffers bar from the fractals indicator, example: Fractals Indicator, has '' SetIndexBuffer(0,ExtUpFractalsBuffer);''
so i want to use the last 3 value of this ' ExtUpFractalsBuffer'' and the same for ''ExtDownFractalsBuffer' !
Thank you very much!