Download MetaTrader 5
To add comments, please log in or register
Did you like the article? Share it with your friends!
REMY RENE JACQUES PUDDU
449
REMY RENE JACQUES PUDDU 2012.05.18 11:43 

hi, i was just wondering if there is a special way to get a trend line value (OBJ_TREND) for example

trend line bar with shift=5

or should i use an afine function like y=ax+b ?

edit : i didn't search enough.


here is the solution

double price=ObjectGetValueByShift("MyTrendLine#123", 11);
Do Hung
147
Do Hung 2015.08.03 04:34  

Hi,

I am coding an EA that reads multiple Pairs and multiple timeframe.

That's why, I can not use  ObjectGetValueByShift to get value

I use function y = ax + b. While y = price and x = time.

double a = (y1-y2)/(x1-x2);
double b = y1 - a*x1;

 

After canculate a and b, I try to get price (y) of trendline at anytime

However, I can not get right value. 

Please support!  Thanks!

/
To add comments, please log in or register