Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MASrategy"/> class.
 /// Constructs a Moving Average strategy based on the long and short MA strategy
 /// parameters:
 /// If MA short > MA long => Buy
 /// If MA long > MA short => Sell
 /// </summary>
 /// <param name="maShortLevel">ex 25</param>
 /// <param name="maLongLevel">ex 100</param>
 /// <param name="amount">Amount invested in strategy</param>
 /// <param name="takeProfitInBps">PnL at which we take profit and close position</param>
 public MAStrategy(int maShortLevel, int maLongLevel, double amount, double takeProfitInBps)
     : base(takeProfitInBps, amount)
 {
     this._shortLevel         = maShortLevel;
     this._longLevel          = maLongLevel;
     this._longPricesHistory  = new FIFODoubleArray(this._longLevel);
     this._shortPricesHistory = new FIFODoubleArray(this._shortLevel);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MASrategy"/> class.
 /// Constructs a Moving Average strategy based on the long and short MA strategy
 /// parameters:
 /// If mean + std_inf * std > closing price  => Buy
 /// If closing price > mean + std_sup * std => Sell
 /// </summary>
 /// <param name="maShortLevel">ex 25</param>
 /// <param name="maUpperBound">ex 2</param>
 /// <param name="maLowerBound">ex 2</param>
 /// <param name="amount">Amount invested in strategy</param>
 /// <param name="takeProfitInBps">PnL at which we take profit and close position</param>
 public BollingerStrategy(int bolShortLevel, double bolUpperBound, double bolLowerBound,
                          double amount, double takeProfitInBps)
     : base(takeProfitInBps, amount)
 {
     this._shortLevel         = bolShortLevel;
     this._upperBound         = bolUpperBound;
     this._lowerBound         = bolLowerBound;
     this._shortPricesHistory = new FIFODoubleArray(this._shortLevel);
 }