X number of lines

Hi guys i want help to make x number horizontal lines in my script based on extrn input.

for (minlevels;minlevels<Levels; minlevels=minlevels++)
{

ObjectCreate(“Resistance2”, OBJ_HLINE, 0, 0, (level+minlevels)*value);
ObjectSetInteger(0,“Resistance2”,OBJPROP_COLOR,clrRed);
ObjectSetInteger(0,“Resistance2”,OBJPROP_WIDTH,2);

}

when i use it my window freezes

i have to make x number of horizontal lines based on input.

MQL? What platform?

I can see your for statement is not correctly written, especially minlevels=minlevels++. You can just write minlevels++.

I assume Levels is the input variable?

In addition, Object name needs to change for every level you make so the name should be “Resistance”+minlevels

Try MQL forum, if this is indeed related to MT4/MT5.

Hi thanks

minlevels++ means i will be adding 1 every time to last value and yes you are right minlevels is input value that is set to 1 as default.

secondly you rightly pointed for object name i suppose that is what is causing problem may be i will check and update on it.

I really like it when one of my colleagues shares their experience and lets me learn something useful.
It is really valuable and shows how many problems and issues can be solved through forums and mutual support. It’s really great.