script for simple failover

is it possible to write a script in routeros that ether 1 will ping to 192.168.1.1 if ping is successful ether 2 will be disabled if ping fails then only ether 2 will be enabled if ether 1 succeeds to ping 192.168.1.1 then ether 2 disables again ether 3 will be lan port and all 3 will be in bridge mode.

use
/tool/netwatch set up-script=… down-script=…
&
/ping interface=ether…

It is impossible for the “WAN and LAN” ports to be on a single bridge sir.

why not, if, for example, the provider provides pppoe, then you can easily add the entire port to the bridge.

You can easily add it. Yes, however your LAN starts to leak data to the physical WAN port (not the ppoe) so your LAN traffic would be visible to the ISP infrastructure unless they block it.