Could someone please help me(trendline question) - page 2

 
iFractals returns the high from a bar if the high of 2 bars on both sides lower & vise versa for the low
 
qjol:
iFractals returns the high from a bar if the high of 2 bars on both sides lower & vise versa for the low

thanx for the info, but what is the shift then? if the shift from the current bar or is the number of bars before the current bar within a highest fractal is found? (like iHighest) because if is the shift from the current bar how you can set a static number without knowing if that bar is a fractal...?
 
shift is the number of the bar that you want the fractal value for . . . if there is a fractal on that bar it gives you the high if you specify MODE_UPPER or the low of the bar if you specify MODE_LOWER
 

ok guys thanx a lot for your help, please have a look at this

for(int a=1;a<=Bars;a++)
{
if(iFractals(NULL,NULL,MODE_UPPER,a)!=0) 
{
LastUpFractal=iFractals(NULL,NULL, MODE_UPPER,a);
TimeOfLastUpFractal=Time[a];
break;
}
}
for(int y=1;y<Bars;y++)
{
if(iFractals(NULL,NULL,MODE_LOWER,y)!=0) 
{
LastDWFractal=iFractals(NULL,NULL, MODE_LOWER,y);
TimeOfLastDWFractal=Time[y];
break;
}
}





  dtEnd   = Time[1];//TimeCurrent()+(iForwardBars*300); // n*5 min bars
 sstrCurrentUpLine = "X UP " + TimeToStr(TimeCurrent()); // Set current active line name
 sstrCurrentDownLine = "X DN " + TimeToStr(TimeCurrent());
 
 
 ObjectCreate(sstrCurrentUpLine, OBJ_TREND, 0, TimeOfLastUpFractal, LastUpFractal, dtEnd, High[1]);
 ObjectSet(sstrCurrentUpLine, OBJPROP_COLOR, Red);
 ObjectSet(sstrCurrentUpLine, OBJPROP_STYLE, STYLE_SOLID);
 ObjectSet(sstrCurrentUpLine, OBJPROP_WIDTH, 2);
 ObjectSet(sstrCurrentUpLine, OBJPROP_RAY, False);



 ObjectCreate(sstrCurrentDownLine, OBJ_TREND, 0, TimeOfLastDWFractal, LastDWFractal, dtEnd, Low[1]);
 ObjectSet(sstrCurrentDownLine, OBJPROP_COLOR, Blue);
 ObjectSet(sstrCurrentDownLine, OBJPROP_STYLE, STYLE_SOLID);
 ObjectSet(sstrCurrentDownLine, OBJPROP_WIDTH, 2);
 ObjectSet(sstrCurrentDownLine, OBJPROP_RAY, False);
 
  

}
      

this will give me a trendline from the previously fractal...can you give me a hint how to loop lets say 40 bars back and only consider the highest in the case of up trendeline and lower for the down trendline fractal?

 
maybe create an array of fractals for the previously 40 bars and then get the highest value in the array and the index of that bar for later use..
 
for the projected line past the current bar it was a easy fix.. just changed OBJPROP_RAY to true...learning step by step... :-))
 
Could you please share your full code for us to use? Thx
Reason: