I draw manually trends on a window. But often flat trends are difficult to make really flat.
This is why I'm looking for a code that will correct the price value of the end charpoint of the trend line.
I'm struggling on the final part, if someone could help me to fix this it will be very helpful for me.
Thank you in advance for you collaboration.
Code: Select all
protected override void CalcBar()
if (Bars.LastBarOnChart && CHRONO_START == 0 )
foreach (ITrendLineObject MVT in DrwTrendLine.GetTrendLineObjects(EDrawingSource.Manual))
//Set MVT values
MVT_TIME_BEG = MVT.Begin.Time.AddMinutes(-Bars.Info.Resolution.Size);
MVT_TIME_END = MVT.End.Time;
MVT_PRICE_BEG = MVT.Begin.Price;
MVT_PRICE_END = MVT.End.Price;
MVT_AMP = Math.Abs(MVT.End.Price - MVT.Begin.Price);
if ( MVT_AMP < 5 )
MVT.End.Price = MVT.Begin.Price; // *********this part doesn't work*********