I'm trying to translate an algorithm I wrote in MultiCharts/Tradestation's Power/EasyLanguage into C#. I'm new to C# and coding in general, so this has proved rather difficult, but I'm pretty close to done now. The last remaining issue I have is I need to implement a trailing stop that functions in the same way that PercentTrailing works: 

https://www.multicharts.com/trading-software/index.php/SetPercentTrailing

I take it I need to calculate the maximum profit somehow, but due to my inexperience with C# I'm not sure how I'd go about doing this. I also noticed that in the documentation there is a TrailingStop Field: https://www.quantconnect.com/lean/documentation/topic5664.html

How could I go about using this? I don't see what parameters it takes/how to actually use it as an order.

Thanks in advance!

Author