ObjectFind() returns number of subwindow, starting with 0.
You create objects in subwindow 0, but your test looks like this:
if(ObjectFind(0,"Ceiling")>1) { HLineMove(0,"Ceiling",Ceiling); } if(ObjectFind(0,"Floor")>1) { HLineMove(0,"Floor",Floor); }
This should be:
if(ObjectFind(0,"Ceiling")>=0) { HLineMove(0,"Ceiling",Ceiling); } if(ObjectFind(0,"Floor")>=0) { HLineMove(0,"Floor",Floor); }
Even better:
if(ObjectFind("Ceiling")>=0) { HLineMove(0,"Ceiling",Ceiling); } else { HLineCreate(0,"Ceiling",0,Ceiling,InpCeilingColor,InpCeilingStyle,InpCeilingWidth,InpCeilingBack,InpCeilingSelection,InpCeilingHidden,InpCeilingZOrder); } if(ObjectFind("Floor")>=0) { HLineMove(0,"Floor",Floor); } else { HLineCreate(0,"Floor",0,Floor,InpFloorColor,InpFloorStyle,InpFloorWidth,InpFloorBack,InpFloorSelection,InpFloorHidden,InpFloorZOrder); }
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
I have an indicator that draws horizontal lines on a chart based on swings. Now, the math works every time (Comment() shows the values). But the indicator isn't re-drawing when it should.
Can anyone tell me why?
Note: the functions HLineCreate, HLineMove, HLineDelete are from the help text.