script to auto change timeframe

 

HI

i have an EA that works of timeframe, is there a way to change the timeframe if there are more than 4 orders placed?

Also is there a script auto close the chart after trade is complete?