Yes set OBJPROP_SELECTED to true.
Thanks Marco! That works great! Do you think is there a way to have it selected and not to have it anchored at the moment of creation? I have the code like this and it creates the line on the Ask.
if(id==CHARTEVENT_OBJECT_CLICK && sparam=="Object3")
{
ObjectCreate("StopPrice",OBJ_HLINE,0,0,Ask);
ObjectSet("StopPrice",OBJPROP_SELECTED,True);
}
You can, but unless the price you create it with is on the chart, you won't be able to see it, and won't be able to move it.
Instead, just create it in the middle of the chart.
Chart Price Max/Min - MQL4 programming forum
You can, but unless the price you create it with is on the chart, you won't be able to see it, and won't be able to move it.
Instead, just create it in the middle of the chart.
Chart Price Max/Min - MQL4 programming forum

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Friends,
I've created a custom button and my intent is that when I press it, it creates a horizontal line with preset parameters. May I ask if it is possible to create OBJ_HLINE without any price anchor point so that I can place it on a chart wherever I wish, just like I would with the draw horizontal line button?
Thank you for your help!
M