| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 0.000% Drawdown 0.000% Expectancy 0 Net Profit 0.000% Sharpe Ratio -1.281 Probabilistic Sharpe Ratio 0.379% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 1.196 Tracking Error 0.047 Treynor Ratio -0.06 Total Fees $0.00 Estimated Strategy Capacity $520000000000.00 Lowest Capacity Asset EURUSD 8G |
namespace QuantConnect.Algorithm.CSharp
{
public class OandaBrokerageExampleAlgorithm : QCAlgorithm
{
private Symbol _symbol;
public override void Initialize()
{
SetStartDate(2021, 1, 1);
SetCash(100000);
SetBrokerageModel(BrokerageName.OandaBrokerage, AccountType.Margin);
_symbol = AddForex("EURUSD", Resolution.Minute).Symbol;
}
public override void OnData(Slice data)
{
if (Portfolio.Invested)
{
return;
}
// Place an order with the default order properties
var ticket = LimitOrder(_symbol, 1, Math.Round(data[_symbol].Price * .9m, 5));
// Update the order
var orderFields = new UpdateOrderFields {
Quantity = 2,
LimitPrice = Math.Round(data[_symbol].Price * 1.1m, 5),
Tag = "Informative order tag"
};
var response = ticket.Update(orderFields);
if (!LiveMode && response.IsSuccess)
{
Debug("Order updated successfully");
}
}
}
}