Download MetaTrader 5

What is the code for drawing one Horizontal Line at a specific price??

To add comments, please log in or register
daniel
204
daniel  

Hello,

I am new in all this of programming, i am trying to build my first indicator.

I need that the indicator, draws a single line at opening price for the first minute candle of each day, at 00:01 (t=1), and erase it at 23:59 (t=1439).

i need that the price for this line does not change in time until 23:59 when it shall be erased, and reinitiate again at 00:01 for the next day.

Can anybody help me with this code?

thank you in advance!!

whroeder1
15574
whroeder1  
daniel1983:

I am new in all this of programming, i am trying to build my first indicator.

I need that the indicator, draws a single line at opening price for the first minute candle of each day, at 00:01 (t=1), and erase it at 23:59 (t=1439).

i need that the price for this line does not change in time until 23:59 when it shall be erased, and reinitiate again at 00:01 for the next day.

You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Jack Thomas
503
Jack Thomas  

Read about these functions.

https://docs.mql4.com/objects

https://docs.mql4.com/objects/ObjectCreate

https://docs.mql4.com/objects/ObjectSet

https://docs.mql4.com/series

Try to do it first, then post your code if it simply isn't working for you.

The only way to learn is to try and do it.

whroeder1
15574
whroeder1  
OP said he "need that the indicator" What he asked for can be done with a single buffer. No objects necessary. Indicators use buffers not objects when at all possible.
for(int iBar = Bars - 1 - IndicatorCounted(); iBar >= 0; iBar--){
   int iBarD1 = iBarShift(NULL, PERIOD_D1, Time[0]);
   buffer[iBar] = iOpen(NULL, PERIOD_D1, iBarD1);
}
Keith Watford
Moderator
10566
Keith Watford  
WHRoeder:
OP said he "need that the indicator" What he asked for can be done with a single buffer. No objects necessary. Indicators use buffers not objects when at all possible.

I would have thought it to be simpler to either use a trend line or horizontal line object in this case, draw it once and then move it at the first tick of the day.
To add comments, please log in or register