OBJPROP_TIME OBJPROP_PRICE
Cromo: To get the onject price on the current bar, I used Time[0] But it is not working. Is this correct?
- Your code only select a trend line what has the first coordinate at Time[0]. Were they both drawn from bar zero backwards? Otherwise, you will not select them.
- Your code reads one of the two trend line coordinates; has nothing to do what you want.
- Perhaps you should read the manual.
ObjectGetValueByShift - Object Functions - MQL4 Reference
Hi, William
Great hint.
Thanks.
ObjectGetValueByShift
solve the issue!
Thanks for the ObjectsTotal() / ObjectName() cycle. I haven't figured this one out myself. :)
I have a slightly different problem. I can read the price values of trendlines, but I need to know the upcoming price value too. If I hover the mouse over them it appears on screen so the data is there. (I use ray_right=true parameter when I create a trendline.) The following code works in Strategy Tester but it always gives me 0.0 in live conditions:
MqlDateTime dTimeStruc; TimeLocal(dTimeStruc); if ( ObjectFind(0, "SupportTL") >= 0 ) { PriceData.PeriodTempUpdate(); //sets iPeriodTemp variable dTimeStruc.min += iPeriodTemp / 60; double dPrice1 = ObjectGetValueByTime(0, "SupportTL", StructToTime(dTimeStruc), 0); //test Print("TEST: Support Trend Line Price value for next bar: ", DoubleToString(dPrice1, Digits())); }
What am I'm missing?
ObjectGetValueByTime()
Time = Time[0]
Time = Time[0]
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I want to read the price from the trend line object.
I just want to get the price (upper and lower line ) on the current bar.
This is my code.
To get the onject price on the current bar, I used Time[0]
But it is not working.
Is this correct?