Help with trade execution on current code

 

Hi


i need help with some coding , i have code that creates horizontal lines on the chart , but i need trades to execute once those lines are touched (do not want to use pending orders)

only 1 trade should be active at a time and there after the the code can loop. please assist if possible

Files: