Hello Forum, I am attempting to put together an indicator that draws a horizontal line of fixed length to the right of current price action at the level of the most recent high and low fractals,
and also draws trendlines through the 2 most recent high fractal positions 2 most recent low fractal positions.
I have had some success previously in drawing a horizontal line at current fractal levels (but not today, perhaps a loop problem that I can't see as am too close to it...)
But I remain confused about how to find the second non zero, not empty buffer values for the low and high fractals and then the order I use them to create my trend lines
Thanks Raptor, I had been stuck, taken a break from the coding and not realised WHRoeder had shared an additional piece of the answer 10 days ago.
Will reproduce it below and see how far I can progress this indicator now. IT addresses the non zero bit of my question.
Thanks as always !!
Still having problems here:
Have tried to simplify and take on advice from previous post, but must be a problem in my understanding of the outcome of the standard if statements at lines 73, 75, 100 and 102
(and consequently the advice in https://www.mql5.com/en/forum/143563
Whilst the code below compiles without error
A check using CtrlB reveals that I am not getting any objects created, let alone incorrect objects
Some help with this would be greatly appreciated, I have been going round in circles for days.
My aim is to have this indicator draw trendlines through the most recent 2 high and low fractal values...
//+------------------------------------------------------------------+ //| | //| Copyright © 1999-2008, MetaQuotes Software Corp. | //| http://www.metaquotes.ru | //+------------------------------------------------------------------+ //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 //---- input parameters extern string help1 = "use to add fractal lines to chart"; extern bool Draw_FractalsLines = true; // set true to display fractals double HVal[],LVal[],HValTime[],LValTime[]; double ExtUpFractalsBuffer[]; double ExtDownFractalsBuffer[]; int Up; int Down; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator buffers mapping SetIndexBuffer(0,ExtUpFractalsBuffer); SetIndexBuffer(1,ExtDownFractalsBuffer); //---- SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); //---- DataWindow and indicator subwindow label IndicatorShortName("current fractal levels"); SetIndexLabel(0,"CurrentHVal"); SetIndexLabel(1,"CurrentLVal"); //---- initialization done return(0); } //+-------------------------------------------------------------------------------------------------------+ //---- Custom indicator deinitialization function | //+-------------------------------------------------------------------------------------------------------+ int deinit() { ObjectDelete("HighFractalsLine"); ObjectDelete("LowFractalsLine"); return(0); } //+-------------------------------------------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- the last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { //-- Define the Upper Fractals buffer as ExtUpFractalsBuffer[i]=iFractals(NULL,0,MODE_UPPER,i); //-- Define the Lower Fractals buffer as ExtDownFractalsBuffer[i]=iFractals(NULL,0,MODE_LOWER,i); //---------------------------------------------------------------------------------------------------------- //-- AIM OF INDICATOR TO DRAW TRENDLINES THROUGH THE MOST RECENT 2 ExtUpFractalsBuffer //-- so want the last 2 NotEmpty Values of both Buffers //-- call the most recent time that the up buffer is not an empty value: time = Up //-- call the 2nd most recebr tome that the up buffer is not an empty value: time = (Up+1) //-- similar for down buffer, times are: Down and (Down+1) //---------------------------------------------------------------------------------------------------------- if (ExtUpFractalsBuffer[i]!=EMPTY_VALUE) //--Line 73 return (HVal[Up]); if (ExtUpFractalsBuffer[i]==EMPTY_VALUE) //--Line 75 return (EMPTY); // put these values in an array of up values HVal[Up]=iFractals(NULL,0,MODE_UPPER,i); HValTime[Up]=Time[i]; if (Up>1) { //-- Draw High Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("HighFractalsLine") == -1) ObjectCreate ("HighFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("HighFractalsLine", OBJPROP_TIME1, HValTime[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_TIME2, HValTime[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE1, HVal[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE2, HVal[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_RAY, true); ObjectSet ("HighFractalsLine", OBJPROP_COLOR, Red); ObjectSet ("HighFractalsLine", OBJPROP_WIDTH, 4); } } //---------------------------------------------------------------------------------------------------------- if (ExtDownFractalsBuffer[i]!=EMPTY_VALUE) //-- Line 100 return (LVal[Down]); if (ExtDownFractalsBuffer[i]==EMPTY_VALUE) //-- Line 102 return (EMPTY); //-- put the values in the array of down fractals LVal[Down]=iFractals(NULL,0,MODE_LOWER,i); LValTime[Down]=Time[i]; if (Down>1) { //-- Draw Low Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("LowFractalsLine") == -1) ObjectCreate ("LowFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("LowFractalsLine", OBJPROP_TIME1, LValTime[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_TIME2, LValTime[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE1, LVal[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE2, LVal[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_RAY, true); ObjectSet ("LowFractalsLine", OBJPROP_COLOR, Blue); ObjectSet ("LowFractalsLine", OBJPROP_WIDTH, 4); } } } //+-------------------------------------------------------------------------------------------------------+ return(0); } //+-------------------------------------------------------------------------------------------------------+
Still having problems here:
Have tried to simplify and take on advice from previous post, but must be a problem in my understanding of the outcome of the standard if statements at lines 73, 75, 100 and 102
(and consequently the advice in https://www.mql5.com/en/forum/143563
Whilst the code below compiles without error
A check using CtrlB reveals that I am not getting any objects created, let alone incorrect objects
Have a think about this and explain how the code gets past these lines . . .
if (ExtUpFractalsBuffer[i]!=EMPTY_VALUE) //--Line 73 return (HVal[Up]); if (ExtUpFractalsBuffer[i]==EMPTY_VALUE) //--Line 75 return (EMPTY);
Have a think about this and explain how the code gets past these lines . . .
Thanks for persisting with helping me here. Can't believe how much trouble I am having with this concept.
I drew myself a diagram, attached to show to myself that in the pictured example, I would want to take my Upper Buffer values from bars 2 and 11, and my lower fractal values from bars 4 and 12.
By my logic that means that iFractals(NULL,0,MODE_UPPER,i) will return an empty value from bars 0 and 1 and a not empty value at Bar2, then empty values for bars 3 through to 10, then, non empty value at Bar 11
My thoughts then are that the buffer containing upper fractal values for the purposes of fractal line drawing contains at Up=1 the value for bar 2 and at Up=2 the value for bar 11
Similarly for the buffer containing lower fractal values for the purpose of fractal line drawing contains at Down=1, the value of the bar 4 and at Down=2, the value of the bar 12
perhaps this is where I am coding inaccurately as I thought the above words equate to lines 73-76 and 100-103 below.
Now the indicator registers as having high and low fractal lines (CtrlB) but no values assigned to price or time to allow them to plot ????
//+------------------------------------------------------------------+ //| | //| Copyright © 1999-2008, MetaQuotes Software Corp. | //| http://www.metaquotes.ru | //+------------------------------------------------------------------+ //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 //---- input parameters extern string help1 = "use to add fractal lines to chart"; extern bool Draw_FractalsLines = true; // set true to display fractals double HVal[],LVal[],HValTime[],LValTime[]; double ExtUpFractalsBuffer[]; double ExtDownFractalsBuffer[]; int Up; int Down; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator buffers mapping SetIndexBuffer(0,ExtUpFractalsBuffer); SetIndexBuffer(1,ExtDownFractalsBuffer); //---- SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); //---- DataWindow and indicator subwindow label IndicatorShortName("current fractal levels"); SetIndexLabel(0,"CurrentHVal"); SetIndexLabel(1,"CurrentLVal"); //---- initialization done return(0); } //+-------------------------------------------------------------------------------------------------------+ //---- Custom indicator deinitialization function | //+-------------------------------------------------------------------------------------------------------+ int deinit() { ObjectDelete("HighFractalsLine"); ObjectDelete("LowFractalsLine"); return(0); } //+-------------------------------------------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- the last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { //-- Define the Upper Fractals buffer as ExtUpFractalsBuffer[i]=iFractals(NULL,0,MODE_UPPER,i); //-- Define the Lower Fractals buffer as ExtDownFractalsBuffer[i]=iFractals(NULL,0,MODE_LOWER,i); //---------------------------------------------------------------------------------------------------------- //-- AIM OF INDICATOR TO DRAW TRENDLINES THROUGH THE MOST RECENT 2 ExtUpFractalsBuffer //-- so want the last 2 NotEmpty Values of both Buffers //-- call the most recent time that the up buffer is not an empty value: time = Up //-- call the 2nd most recebr tome that the up buffer is not an empty value: time = (Up+1) //-- similar for down buffer, times are: Down and (Down+1) //---------------------------------------------------------------------------------------------------------- if (ExtUpFractalsBuffer[i]!=EMPTY_VALUE) //--Line 73 HVal[Up]=iFractals(NULL,0,MODE_UPPER,i); if (ExtUpFractalsBuffer[i]==EMPTY_VALUE) //--Line 75 HVal[Up]=iFractals(NULL,0,MODE_UPPER,Up); HValTime[Up]=Time[i]; Up++; if (Up>1) { //-- Draw High Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("HighFractalsLine") == -1) ObjectCreate ("HighFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("HighFractalsLine", OBJPROP_TIME1, HValTime[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_TIME2, HValTime[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE1, HVal[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE2, HVal[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_RAY, true); ObjectSet ("HighFractalsLine", OBJPROP_COLOR, Red); ObjectSet ("HighFractalsLine", OBJPROP_WIDTH, 4); } } //---------------------------------------------------------------------------------------------------------- if (ExtDownFractalsBuffer[i]!=EMPTY_VALUE) //-- Line 100 LVal[Down]=iFractals(NULL,0,MODE_LOWER,i); if (ExtDownFractalsBuffer[i]==EMPTY_VALUE) //-- Line 102 LVal[Down]=iFractals(NULL,0,MODE_LOWER,Down); LValTime[Down]=Time[i]; Down++; if (Down>1) { //-- Draw Low Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("LowFractalsLine") == -1) ObjectCreate ("LowFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("LowFractalsLine", OBJPROP_TIME1, LValTime[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_TIME2, LValTime[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE1, LVal[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE2, LVal[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_RAY, true); ObjectSet ("LowFractalsLine", OBJPROP_COLOR, Blue); ObjectSet ("LowFractalsLine", OBJPROP_WIDTH, 4); } } } //+-------------------------------------------------------------------------------------------------------+ return(0); } //+-------------------------------------------------------------------------------------------------------+
Thanks for persisting with helping me here. Can't believe how much trouble I am having with this concept.
Perhaps you could answer the question I asked ? there was a good reason for asking it . . .
My apologies, when I read your question, I jumped to the answer and assumed it obviously can't get past these lines.
I actually had never used "return" in my simple programming so far, and only tried using it because of WHRoeders post.
Now reading the documentation again.
I believe I would have to set up the code in away to read something like this, mind you I have no experience of formatting it properly
This way the HVal[Up] buffer only gets populated when Up=i
for(i=0;i<limit;i++) { if iFractals(NULL,0,MODE_UPPER,i)!=EMPTY_VALUE return (Up=i);return (Up=EMPTY);} HVal[Up]=iFractals(NULL,0,MODE_UPPER,i); }
Am I on the right track here? That being that the calculations have to be completed within the {} to allow the code to move forward?
My apologies, when I read your question, I jumped to the answer and assumed it obviously can't get past these lines.
I actually had never used "return" in my simple programming so far, and only tried using it because of WHRoeders post.
Now reading the documentation again.
I believe I would have to set up the code in away to read something like this, mind you I have no experience of formatting it properly
This way the HVal[Up] buffer only gets populated when Up=i
Am I on the right track here? That being that the calculations have to be completed within the {} to allow the code to move forward?
It seems you do not understand what return does . . . . what calls the start() function ? to what are you returning a value ? why do you want the start() function to exit there ?
WHRoeder used return at the end of his user defined function.
It seems you do not understand what return does . . . . what calls the start() function ? to what are you returning a value ? why do you want the start() function to exit there ?
WHRoeder used return at the end of his user defined function.
While I try and learn how to use return correctly, thought I would go back to your advice in the other post referenced above "..so create a loop, for or while, they are interchangeable, that starts at 0, the last arrow position and loops through checking if Buffer[i] is != EMPTY_VALUE, when you find the next one that isn't EMPTY_VALUE it is your next arrow....."
If possible, would you please explain why the relevant loop below is not delivering the desired fractal object values. This newbie is getting really stressed at not being able to work this out
thanks as always
//+------------------------------------------------------------------+ //| | //| Copyright © 1999-2008, MetaQuotes Software Corp. | //| http://www.metaquotes.ru | //+------------------------------------------------------------------+ //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 //---- input parameters extern string help1 = "use to add fractal lines to chart"; extern bool Draw_FractalsLines = true; // set true to display fractals double HVal[],LVal[],HValTime[],LValTime[]; double ExtUpFractalsBuffer[]; double ExtDownFractalsBuffer[]; int Up; int Down; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator buffers mapping SetIndexBuffer(0,ExtUpFractalsBuffer); SetIndexBuffer(1,ExtDownFractalsBuffer); //---- SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); //---- DataWindow and indicator subwindow label IndicatorShortName("current fractal levels"); SetIndexLabel(0,"CurrentHVal"); SetIndexLabel(1,"CurrentLVal"); //---- initialization done return(0); } //+-------------------------------------------------------------------------------------------------------+ //---- Custom indicator deinitialization function | //+-------------------------------------------------------------------------------------------------------+ int deinit() { ObjectDelete("HighFractalsLine"); ObjectDelete("LowFractalsLine"); return(0); } //+-------------------------------------------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- the last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { //-- Define the Upper Fractals buffer as ExtUpFractalsBuffer[i]=iFractals(NULL,0,MODE_UPPER,i); if (iFractals(NULL,0,MODE_UPPER,i)!=EMPTY_VALUE) HVal[Up]=iFractals(NULL,0,MODE_UPPER,i); for (int Up=1;Up<limit;Up++) if (iFractals(NULL,0,MODE_UPPER,i)==EMPTY_VALUE) HVal[Up]=iFractals(NULL,0,MODE_UPPER,Up-1); HValTime[Up]=Time[i]; //-- Draw High Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("HighFractalsLine") == -1) ObjectCreate ("HighFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("HighFractalsLine", OBJPROP_TIME1, HValTime[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_TIME2, HValTime[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE1, HVal[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE2, HVal[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_RAY, true); ObjectSet ("HighFractalsLine", OBJPROP_COLOR, Red); ObjectSet ("HighFractalsLine", OBJPROP_WIDTH, 4); } } //---------------------------------------------------------------------------------------------------------- { //-- Define the Lower Fractals buffer as ExtDownFractalsBuffer[i]=iFractals(NULL,0,MODE_LOWER,i); if (iFractals(NULL,0,MODE_LOWER,i)!=EMPTY_VALUE) LVal[Down]=iFractals(NULL,0,MODE_LOWER,i); for(int Down=1;Down<limit;Down++) if (ExtDownFractalsBuffer[i]==EMPTY_VALUE) LVal[Down]=iFractals(NULL,0,MODE_LOWER,Down-1); LValTime[Down]=Time[i]; //-- Draw Low Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("LowFractalsLine") == -1) ObjectCreate ("LowFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("LowFractalsLine", OBJPROP_TIME1, LValTime[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_TIME2, LValTime[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE1, LVal[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE2, LVal[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_RAY, true); ObjectSet ("LowFractalsLine", OBJPROP_COLOR, Blue); ObjectSet ("LowFractalsLine", OBJPROP_WIDTH, 4); } } //+-------------------------------------------------------------------------------------------------------+ return(0); } //+-------------------------------------------------------------------------------------------------------+
While I try and learn how to use return correctly, thought I would go back to your advice in the other post referenced above "..so create a loop, for or while, they are interchangeable, that starts at 0, the last arrow position and loops through checking if Buffer[i] is != EMPTY_VALUE, when you find the next one that isn't EMPTY_VALUE it is your next arrow....."
If possible, would you please explain why the relevant loop below is not delivering the desired fractal object values. This newbie is getting really stressed at not being able to work this out
thanks as always
Do you find it easy to read your own code without using any kind of indenting to mark blocks of code controlled by { } braces ? I don't, i find it a pain in the neck and it takes me at least twice as long to follow, maybe more . . .
To read your code easily I have to do this . . .
//+------------------------------------------------------------------+ //| | //| Copyright © 1999-2008, MetaQuotes Software Corp. | //| http://www.metaquotes.ru | //+------------------------------------------------------------------+ //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 //---- input parameters extern string help1 = "use to add fractal lines to chart"; extern bool Draw_FractalsLines = true; // set true to display fractals double HVal[],LVal[],HValTime[],LValTime[]; double ExtUpFractalsBuffer[]; double ExtDownFractalsBuffer[]; int Up; int Down; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator buffers mapping SetIndexBuffer(0,ExtUpFractalsBuffer); SetIndexBuffer(1,ExtDownFractalsBuffer); //---- SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); //---- DataWindow and indicator subwindow label IndicatorShortName("current fractal levels"); SetIndexLabel(0,"CurrentHVal"); SetIndexLabel(1,"CurrentLVal"); //---- initialization done return(0); } //+-------------------------------------------------------------------------------------------------------+ //---- Custom indicator deinitialization function | //+-------------------------------------------------------------------------------------------------------+ int deinit() { ObjectDelete("HighFractalsLine"); ObjectDelete("LowFractalsLine"); return(0); } //+-------------------------------------------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- the last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { //-- Define the Upper Fractals buffer as ExtUpFractalsBuffer[i]=iFractals(NULL,0,MODE_UPPER,i); if (iFractals(NULL,0,MODE_UPPER,i)!=EMPTY_VALUE) HVal[Up]=iFractals(NULL,0,MODE_UPPER,i); for (int Up=1;Up<limit;Up++) if (iFractals(NULL,0,MODE_UPPER,i)==EMPTY_VALUE) HVal[Up]=iFractals(NULL,0,MODE_UPPER,Up-1); HValTime[Up]=Time[i]; //-- Draw High Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("HighFractalsLine") == -1) ObjectCreate ("HighFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("HighFractalsLine", OBJPROP_TIME1, HValTime[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_TIME2, HValTime[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE1, HVal[Up+1] ); ObjectSet ("HighFractalsLine", OBJPROP_PRICE2, HVal[Up] ); ObjectSet ("HighFractalsLine", OBJPROP_RAY, true); ObjectSet ("HighFractalsLine", OBJPROP_COLOR, Red); ObjectSet ("HighFractalsLine", OBJPROP_WIDTH, 4); } } //---------------------------------------------------------------------------------------------------------- { //-- Define the Lower Fractals buffer as ExtDownFractalsBuffer[i]=iFractals(NULL,0,MODE_LOWER,i); if (iFractals(NULL,0,MODE_LOWER,i)!=EMPTY_VALUE) LVal[Down]=iFractals(NULL,0,MODE_LOWER,i); for(int Down=1;Down<limit;Down++) if (ExtDownFractalsBuffer[i]==EMPTY_VALUE) LVal[Down]=iFractals(NULL,0,MODE_LOWER,Down-1); LValTime[Down]=Time[i]; //-- Draw Low Fractal Line if (Draw_FractalsLines) // draw if true { if (ObjectFind ("LowFractalsLine") == -1) ObjectCreate ("LowFractalsLine", OBJ_TREND, 0, 0, 0, 0, 0); ObjectSet ("LowFractalsLine", OBJPROP_TIME1, LValTime[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_TIME2, LValTime[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE1, LVal[Down+1] ); ObjectSet ("LowFractalsLine", OBJPROP_PRICE2, LVal[Down] ); ObjectSet ("LowFractalsLine", OBJPROP_RAY, true); ObjectSet ("LowFractalsLine", OBJPROP_COLOR, Blue); ObjectSet ("LowFractalsLine", OBJPROP_WIDTH, 4); } } //+-------------------------------------------------------------------------------------------------------+ return(0); } //+-------------------------------------------------------------------------------------------------------+
. . . that took me 7 minutes. Now I can read it . . .
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Forum, I am attempting to put together an indicator that draws a horizontal line of fixed length to the right of current price action at the level of the most recent high and low fractals,
and also draws trendlines through the 2 most recent high fractal positions 2 most recent low fractal positions.
I have had some success previously in drawing a horizontal line at current fractal levels (but not today, perhaps a loop problem that I can't see as am too close to it...)
But I remain confused about how to find the second non zero, not empty buffer values for the low and high fractals and then the order I use them to create my trend lines
I have attempted to code below
Hoping someone might help me find the problems and help educate me, any advice appreciated
thanks Dave