| Overall Statistics |
|
Total Trades 2 Average Win 0% Average Loss -0.55% Compounding Annual Return -93.301% Drawdown 0.600% Expectancy -1 Net Profit -0.554% Sharpe Ratio 0 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $23.20 |
public class TradesTime : QCAlgorithm
{
public override void Initialize()
{
SetBrokerageModel(BrokerageName.FxcmBrokerage);
DateTime start = new DateTime(2017, 05, 12, 7, 30, 00);
DateTime end = new DateTime(2017, 05, 12, 8, 00, 00);
SetStartDate(start); //Set Start Date
SetEndDate(end); //Set End Date
SetCash(100000);
AddForex("EURUSD", Resolution.Minute, Market.FXCM, true, 10);
}
public override void OnData(Slice data)
{
DateTime specificTradeBarTime = new DateTime(2017, 05, 12, 7, 48, 00);
int quantity = -290000;
TradeBar td = data.Bars["EURUSD"];
decimal stoploss = 1.09174m;
decimal profitTarget = 1.08787m;
if (td.Time == specificTradeBarTime)
{
this.MarketOrder("EURUSD", quantity, false, $"Entry");
this.LimitOrder("EURUSD", -quantity, profitTarget, $"Profit Target");
this.StopMarketOrder("EURUSD", -quantity, stoploss, $"Stop Loss");
}
}
public override void OnOrderEvent(OrderEvent orderEvent)
{
if (orderEvent.Status == OrderStatus.Filled)
{
var order = this.Transactions.GetOrderById(orderEvent.OrderId);
Debug($"Filled orderId {orderEvent.OrderId}, tag: '{order.Tag}', at (UTC): {orderEvent.UtcTime}");
}
}
}