How to get PriceLevel of TrendLine (Ray in the future direction)? New comment Bayne 2019.04.14 14:48 Hey... the Trenline already exists, but i cant get the Pricelevel of it on the current bar... i tried it like this, but it still returns 0 double getCurrentPriceOfTrendLine(const string name) { int type = (int)ObjectGetInteger(0, name, OBJPROP_TYPE); if(type == OBJ_TREND) { datetime dt1 = (datetime)ObjectGetInteger(0, name, OBJPROP_TIME, 0); datetime dt2 = (datetime)ObjectGetInteger(0, name, OBJPROP_TIME, 1); int i1 = iBarShift(NULL, 0, dt1, true); int i2 = iBarShift(NULL, 0, dt2, true); if(i1 <= i2 || i1 == -1 || i2 == -1) { Print("Incorrect line: ", name); return 0; } double p1 = ObjectGetDouble(0, name, OBJPROP_PRICE, 0); double p2 = ObjectGetDouble(0, name, OBJPROP_PRICE, 1); double k = -(p1 - p2)/(i2 - i1); double b = -(i1 * p2 - i2 * p1)/(i2 - i1); return b; } return 0; } Edit: This Function was in MQL4 i think... Order valid until certain pricelevel gets reached [Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. Interesting and Humour Seng Joo Thio 2019.04.15 05:20 #1 Bayne: Hey... the Trenline already exists, but i cant get the Pricelevel of it on the current bar... i tried it like this, but it still returns 0 Edit: This Function was in MQL4 i think... Hmm... I copied your code wholesale, and it works perfectly... salu5 Leal 2021.07.29 14:47 #2 Bayne: Hey... the Trenline already exists, but i cant get the Pricelevel of it on the current bar... i tried it like this, but it still returns 0Edit: This Function was in MQL4 i think... Yes...it works. New comment
Hey... the Trenline already exists, but i cant get the Pricelevel of it on the current bar...
i tried it like this, but it still returns 0
Edit: This Function was in MQL4 i think...