The code you wrote is wrong. It is wrong in the basic principle/core.
This does NOT work that way. As explained many times ApplyStop does not implement stops inside the function call. It is just a SWITCH that tells BACKTESTER to apply stop at the BACKTEST time, i.e. NOT when your formula executes but AFTER when actual backtesting procedure happens.
Therefore ApplyStop applies ALWAYS to currently backtested instrument and NOT to any other instrument that you might called in your SetForeign.
Multiple calls to ApplyStop with same type have NO effect, other than the LAST ONE applies, because as I wrote, it is just a SWITCH for the backtest (as in the settings). The fact that you turn the switch on and off ten times does not have any effect other than the FINAL setting.
To apply stop to OTHER symbol, you have to run MULTIPLE SYMBOL BACKTEST and use the code like this:
if( Name() == "SYMBOL1" )
// rules and stop FOR SYMBOL 1
if( Name() == "SYMBOL2" )
// rules and stop FOR SYMBOL 2
See also this:
You really need to carefully read this. You should mimick exactly what is written in the KB.