RightEdge - The Ultimate Backtesting and Trading System Development Platform

Setting a Stop Loss

Stop losses can be set one of two ways in RightEdge.  The first method involves setting the value at the system level within the trading system project settings.  Once a trading system is open, click on the top most tree item in the Trading System pane.  This will display the global properties for this trading system.  If the Properties pane does not appear, force it to the visible state by selecting Properties Window from the View menu.

stoploss

The Stop Loss field is indicated in red.  Note that this is represented as a decimal.  So in the case demonstrated above, a 5% stop loss has been set.  Set the stop loss field to 0 if no stop loss order is desired.

Stop Losses can also be set in code where they can be controlled more dynamically.

C#

public class SystemMain : SystemBase

{

    public override void Startup()

    {

        // Setting a global stop loss

        PositionManager.StopLoss = 0.05;

    }

}

Visual Basic

Public Class SystemMain

Inherits SystemBase

    Public Overloads Overrides Sub Startup()

        PositionManager.StopLoss = 0.05

    End Sub

End Class

The samples above show the stop loss being set in the startup function.  This is identical to setting the stop loss in the system properties.  However, the StopLoss variable can be set in any function and it is honored whenever a new position is opened (not necessarily when it is submitted).

See Also

Profit Target

New Trading System

Trading System Pane