Failure to create OBJ_HLINE

 

Guys please help.

I wanted to create OBJ_HLINE but nothing happens. here's the scenario.

in my XAUUSD TF M15 chart I have a multiple HLine. with sample ChartID=00001 and a clickbutton to trigger the below code

Open a new chart with a TF D1 with sample chartID=00002 and create HLine

here's the code

ObjectCreate( 00002 , "Price Action", OBJ_HLINE, 0, 0, NormalizeDouble(price, _Digits));

result= nothing happens, no horizontal line created.

Q: can i draw a horizontal line at TF D1 which is the trigger button inside the TF M15?

 
Michael Quinatadcan Macasil Macasil:

Guys please help.

I wanted to create OBJ_HLINE but nothing happens. here's the scenario.

in my XAUUSD TF M15 chart I have a multiple HLine. with sample ChartID=00001 and a clickbutton to trigger the below code

Open a new chart with a TF D1 with sample chartID=00002 and create HLine

here's the code

result= nothing happens, no horizontal line created.

Q: can i draw a horizontal line at TF D1 which is the trigger button inside the TF M15?

where are you getting the chart IDs from they are not going to be 00001 and 00002...  use 0 for current chart or ChartID() to get the actual current chart id

and did you look for error messages in the Experts tab.

 
Paul Anscombe:

where are you getting the chart IDs from they are not going to be 00001 and 00002...  use 0 for current chart or ChartID() to get the actual current chart id

and did you look for error messages in the Experts tab.

here's the complete code

 if(PressedButton==6)
        {
         long new_chart=ChartOpen(Symbol(), PERIOD_D1);
         ChartApplyTemplate(new_chart, "GoldTomato.tpl");
         ObjectCreate(new_chart, "Price Action", OBJ_HLINE, 0, 0, NormalizeDouble(price, _Digits));
         ObjectSetInteger(new_chart, "Price Action", OBJPROP_WIDTH, 2);        
         ObjectSetInteger(new_chart, "Price Action", OBJPROP_COLOR, clrIndigo); 
        }
but nothing happens. No Object Created. why?
 
Michael Quinatadcan Macasil Macasil:

here's the complete code

but nothing happens. No Object Created. why?

It should work, tried the Excerpt and it drew the Horizontal line, Best guess would be, Print the price value after the button is pressed, to check the pressed button is getting there and the the value of price is set.


 
Thank-god Avwerosuoghene Odukudu:

It should work, tried the Excerpt and it drew the Horizontal line, Best guess would be, Print the price value after the button is pressed, to check the pressed button is getting there and the the value of price is set.


the price is correct. refer attached jpeg. but nothing happens. no horizontal line created.

 if(PressedButton==6)
        {
         long new_chart=ChartOpen(Symbol(), PERIOD_D1);
         ChartApplyTemplate(new_chart, "GoldTomato.tpl");
         ObjectCreate(new_chart, "Price Action", OBJ_HLINE, 0, 0, price);
         ObjectSetInteger(new_chart, "Price Action", OBJPROP_WIDTH, 2);
         ObjectSetInteger(new_chart, "Price Action", OBJPROP_COLOR, clrIndigo);
         Print("After click the button YES "+price);
         ChartRedraw(new_chart);
        }

Guys please correct me what I missed, why i cant created OBJ_HLINE with above code.

Files:
222.jpg  207 kb
222a.jpg  221 kb
 
It takes time to create a chart and the timeframe bars. It takes time to apply a template. Try sleeping a second after the first two operations.
 
William Roeder:
It takes time to create a chart and the timeframe bars. It takes time to apply a template. Try sleeping a second after the first two operations.
         Sleep(60);

lol.

with above code.

Problems solve.

I google for 3days before I posted the issue.

I do RTM but unable to solve, that's why I'm very thankful to you  William Roeder of your assistance.

TWO THUMBS UP

to you Mr.