Hi there,
First of all this site is great it even gave me an aspiration to learn a new language.
In this case it`s a coding language if ya havent guessed that part yet :P
Must say for a total newb it is hard learning a complete new dictoinairy and trying to make sense of it all.
Could someone help me with my project?
I hope that if some one can help me with the first part it wil help me get new insights on how to code while I study the New language some more.
using QuantConnect.Indicators;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// </summary>
public class TestFileWaveRider : QCAlgorithm
{
//Main part of strategy
private BollingerBands UpperBand, LowerBand, MiddleBand;
private CandlestickPatterns Red, Green;
//How to set;(lower_BB, Upper_BB, Average_BB??);
// How to set
//(symbol, Period, k, movingAverageType = 0, resolution = null, selector = null);
/// <summary>
/// Initialize the data and resolution you require for your strategy
/// </summary>
public override void Initialize()
{
//if this is to get the price second is better than minute.
AddCrypto(Ticker, Resolution.Minute, "BTC/USDT", fillDataForward, leverage)
//set leverage
decimal leverage = 1m,
//set portfolio
//set start date for backtest.
SetStartDate(2018, 1, 1);
SetEndDate(2019, 1, 25);
SetCash(5000);
// Define the symbol and "type" of our generic data???
AddData<BinanceBrokerageModel>(UpperBand, Resolution.Hour);
AddData<BinanceBrokerageModel>(LowerBand, Resolution.Hour);
addData<BinanceBrokerageModel>(MiddleBand, Resolution.Hour);
AddData<BinanceBrokerageModel>(UpperBand, Resolution.Minute);
AddData<BinanceBrokerageModel>(LowerBand, Resolution.Minute);
addData<BinanceBrokerageModel>(MiddleBand, Resolution.Minute);
// Set up default Indicators???
UpperHour = BB(UpperBand.Hour, 1);
LowerHour = BB(LowerBand.Hour, 1);
MiddleHour = BB(MiddleBand.Hour, 1);
UpperMinute = BB(UpperBand.Minute, 1);
LowerMinute = BB(LowerBand.Minute, 1);
MiddleMinute = BB(MiddleBand.Minute 1);
}
/// <summary>
/// Custom data event handler:
/// </summary>
public void SetTradesForSmallWaves
{ // Count open posistions
int OpenPosistions = 0
// The higher the equity the higher the Cash should be set. Use as treshhold never loose more then set.
// Open posistions should be balanced to match portfolio total.
if (Cash => 2500 && OpenPosistions =< 10 )
{//Catch Downfall Numbers need tweaking!!!
switch;
case 1: (((LowerHour => ActualPrice || (LowerHour * 1.01 => ActualPrice)) && Current.CandleStick == Red)
Portfolio.Sellorder($50, at ActualPrice + 0.0115); //Day Order
OpenPosistions =+ 1;
if (Current.CandleStick == Red)
{
Hold.OpenPosistion
}
if (Current.CandleStick == Green && (StartPrice.Current.CandleStick * 1.025) => StartPrice.OpenPosistion
{
Close.Posistion;
OpenPosistion =- 1;
}
if (Current.CandleStick == Green && OpenPosistion =< ActualPrice || (OpenPosistion => (ActualPrice * 1.25)
{
Close.Posistion;
OpenPosistion =- 1;
}
if (Current.CandleStick && Previous.CandleStick == Green) && ((Current.CandleStick.price + Previous.CandleStick.Price / 2) * 1.025) => CurrentPrice
Close.Posistion;
OpenPosistion =- 1;
}
{// Ill come up with more cases when I get the first part running.
switch;
case 2: (() && ()
}
{
switch;
case 3;
}
{
switch;
case 4;
}
}
}
public class
{
public
}
}
Douglas Stridsberg
Hi,
There's quite a lot going on in what you've put together. It doesn't look like you've used the Terminal or Visual Studio, because if you had, you would immediately spot a couple of missing semicolons, parantheses and other mistakes.
I recommend you use the Terminal or Visual Studio to build your algorithms.
But first, I recommend you go through a C# tutorial, maybe here or here or here.
Then, when you've completed those, please go through the QuantConnect Bootcamp to familiarise yourself with how to use the framework. Once all of that is done, you can start looking at the example algorithms in the repository to familiarise yourself with how indicators are created.
Halldor Andersen
Hi Freddy.
I'm glad that QuantConnect motivates you to learn a new programming language!
Would you mind sharing the logic of your algorithm, so community members can exchange ideas and help with the implementation of your strategy?
Freddy van Duinen
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
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!