- Accounts & Connection Management
- Data Management & Analysis
- Price Monitoring
- Charting
- Trading
- Scanners
-
Builders
-
Manual Strategy Builder
- Main Concept
- Operand Component
- Algo Elements
-
Use Cases
- How to create a condition on something crossing something
- How to create an indicator based on another indicator
- How to calculate a stop loss based on indicator
- How to submit stop order based on calculated price
- How to calculate a current bar price using a price type from inputs
- How to Use a Closed Bar Price
- Automatic Strategy Builder
-
Manual Strategy Builder
- Autotrading
- FinScript
- Trade Analysis
- Media Feeds
- Logs & Notifications
- UI & UX
ByMarketTradeExitSignal - type of Exit Signal that allows to send a signal to close position immediately by market;
The main function inside which a developer should implement all logic of Stop Loss and Take Profit calculation is OnProcessPosition. The below examle show of implementation of close at some special date and time exit signal.
public class CloseAtDateTimeExitSignal : ByMarketTradeExitSignal
{
/// <summary>
/// The time of the day, HH:mm
/// </summary>
[UnitProperty(Name = "Close At", CategoryName = "Parameters", Order = 0)]
public DateTime CloseAt { get; set; } = DateTime.Now.AddDays(1);
#region Overrides of ByMarketTradeExitSignal
/// <inheritdoc />
protected override void OnProcessPosition(Position position, ref bool closePosition, ref string? signalName)
{
if (Input.Count < 2)
return;
var lastBarTime = Bars.GetLastTime();
if (lastBarTime >= CloseAt)
{
closePosition = true;
signalName = "Exit by date and time";
}
}
#endregion
}
- Accounts & Connection Management
- Data Management & Analysis
- Price Monitoring
- Charting
- Trading
- Scanners
-
Builders
-
Manual Strategy Builder
- Main Concept
- Operand Component
- Algo Elements
-
Use Cases
- How to create a condition on something crossing something
- How to create an indicator based on another indicator
- How to calculate a stop loss based on indicator
- How to submit stop order based on calculated price
- How to calculate a current bar price using a price type from inputs
- How to Use a Closed Bar Price
- Automatic Strategy Builder
-
Manual Strategy Builder
- Autotrading
- FinScript
- Trade Analysis
- Media Feeds
- Logs & Notifications
- UI & UX