LB ECMP 3 Line ISP Failover - Mikrotik Script RouterOS
ECMP or Equal Cost Multi Path is a load balancing method that uses the per address-pair connection load balancing method. ECMP allows a router to have more than one gateway to a destination network. Because the method is per address-pair connection, the load balancing system is that each different address on different connections will probably pass through different gateways.
/ip firewall nat
add chain=srcnat out-interface="ether1" action=masquerade 
add chain=srcnat out-interface="ether2" action=masquerade 
add chain=srcnat out-interface="ether3" distance=2 action=masquerade 
/ip route
add check-gateway=ping distance=1 gateway="192.168.1.1,192.168.2.1,192.168.3.1" 
add check-gateway=ping distance=1 gateway="192.168.1.1" routing-mark="to-ether1" 
add check-gateway=ping distance=1 gateway="192.168.2.1" routing-mark="to-ether2" 
add check-gateway=ping distance=1 gateway="192.168.3.1" routing-mark="to-ether3" 
/ip firewall mangle
add action=mark-connection chain=input in-interface="ether1" new-connection-mark="cm-ether1" 
add action=mark-connection chain=input in-interface="ether2" new-connection-mark="cm-ether2" 
add action=mark-connection chain=input in-interface="ether3" new-connection-mark="cm-ether3" 
add action=mark-routing chain=output connection-mark="cm-ether1" new-routing-mark="to-ether1" 
add action=mark-routing chain=output connection-mark="cm-ether2" new-routing-mark="to-ether2" 
add action=mark-routing chain=output connection-mark="cm-ether3" new-routing-mark="to-ether3"