Hi, I tried to implement some simple RSI strategy in QuantConnect, targeting MSFT and Interactive Brokers, and got stuck with order management. Strategy itself goes long only.

1. I need to open Market Order + Stop Loss, so I execute MarketOrder() and then StopMarketOrder() from OnData, how to make sure that Market Order will not be rejected I will have only Stop Loss filled?

2. how to implement Trailing Stop, or in other words, how to move stop loss orders for all open positions?

3. can't figure out difference between TotlProfit, UnrealizedProfit, etc, how to define condition, like "close all positions when profit is more than 1% or initial balance", when I say balance I mean amount of money with all positions closed

4. in some reason I can use only SPY as a benchmark, how can I compare my strategy equity to original MSFT chart as a benchmark?