Hi there!

Some background on myself: Java developer (mostly EE stuff) who likes dabbling in C, C++, OpenSource, MQL and MetaTrader. As of late I've become frustrated with the quality of MetaTrader's backtesting. I decided to try out QuantConnect, since I'm spending more time sanitizing data and Googling MT4/Ubuntu problems than doing what interests me to begin with - coding and algorithmic trading. 

MT flaws real or perceived, here I am! And I have a few questions after spending the last few days with QuantConnect. Most of my original questions I could resolve by looking at the source code (seeing as C# and Java aren't radically different.) Some others are more a question of wrapping my head around the intended use of the API. In all probability I'm using it incorrectly.

So here are them questions!

1. First off, there's is somewhere something I'm not properly understanding with indiciator resolutions.

Is this similar to MetaTrader's PERIOD constants?

Say I wanted, in metatrader, to obtain the 100 SMA on a half-an-hour chart. I do a method call, I give it a period (defined as a constant) and a shift that would look more or less something like this (this is not exact, I don't have MT on this box):

double sma100 = iMA("EURUSD", PERIOD_M30, MODE_SIMPLE, 0);

Now I want to do this in QuantConnect:

private member variable:

private SimpleMovingAverage _sma100; 

In the initialize method I encounter the problem of resolution.

_sma100 = SMA("EURUSD", 100, Resolution.Minute);

This only gives me SMA100 on a minute basis. What would be the equivalent then of SMA100 for half-an-hour candlesticks be here? 


SMA("EURUSD", 3000, Resolution.Minute);


So, either Resolution isn't like PERIOD in MetaTrader, or QuantConnect doesn't allow Resolutions/Periods on 5min/15min/etc charts.

2. Second, I'm having trouble querying what happened to a trade. Say that I have a strategy that may have two open trades - one long, one short. In this scenario, one of the orders gets filled, and I can confirm that when I write the OrderStatus to debug:


Now, the problem is that this was a StopLimitOrder with a specific stop loss and take profit. The market moves, either the sl or tp gets hit, and... nothing. I don't know how to see from the OrderTicket object whether the order is closed - according to debug, it remains Filled. I know it can't be an active trade anymore though, since SL should have been hit a long time ago.

A similar problem is when I feel that some condition has been met for me to close down the trade. They only way I've found to do this would be to call the Liquidate() function, which would liquidate... everything, right? If I have both a long and a short open, I can't tell it to liquidate only the one and not the other.

Would be fantastic if any of you could provide me with some insight into these.

And, well done on the platform - it looks and works really well!

Kind regards,