Hi,
I'm working on a strategy that makes a lot of trades. The strategy is obviously losing a lot of money but the issue is that the backtest gets stuck and doesnt finish.
What is going wrong? Is it because it is trading too often? Is it a memory issue? Am I running out of something?
Thanks
I've tried multiple times to attach the backtest here but it wont let me. It is just unresponsive. I'm attaching the code instead
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Basic template algorithm simply initializes the date range and cash. This is a skeleton
/// framework you can use for designing an algorithm.
/// </summary>
public class BasicTemplateAlgorithm : QCAlgorithm
{
bool up = false;
decimal lastPrice;
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2008, 01, 01); //Set Start Date
SetEndDate(2017, 01, 01); //Set End Date
SetCash(5000); //Set Strategy Cash
// Find more symbols here: http://quantconnect.com/data
// Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
// Futures Resolution: Tick, Second, Minute
// Options Resolution: Minute Only.
AddForex("EURUSD", Resolution.Minute);
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if(lastPrice - data["EURUSD"].Price > 0)
{
if(up == true)
{
up = false;
//buy
Liquidate();
SetHoldings("EURUSD", -0.5);
}
}
else if(lastPrice - data["EURUSD"].Price < 0)
{
if(up == false)
{
up = true;
//sell
Liquidate();
SetHoldings("EURUSD", 0.5);
}
}
lastPrice = data["EURUSD"].Price;
}
// Fire plotting events once per day:
public override void OnEndOfDay() {
//Debug(" " + GC.GetTotalMemory(true));
}
}
}
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!