Overall Statistics
Total Trades
170
Average Win
0.02%
Average Loss
-0.24%
Compounding Annual Return
-65.813%
Drawdown
3.100%
Expectancy
-0.142
Net Profit
-2.898%
Sharpe Ratio
-5.304
Probabilistic Sharpe Ratio
0.003%
Loss Rate
20%
Win Rate
80%
Profit-Loss Ratio
0.07
Alpha
-0.496
Beta
0.051
Annual Standard Deviation
0.09
Annual Variance
0.008
Information Ratio
-8.355
Tracking Error
0.103
Treynor Ratio
-9.426
Total Fees
$25.01
namespace QuantConnect.Algorithm.CSharp
{
    public class VentralTransdimensionalChamber : QCAlgorithm
    {
        
        // VARIABELEN DECLAREREN
        private string _ticker = "ETHUSD";            //virtueel paar - tracks the current USD value of 1 ether.
        private int _startingCash = 1000;
        private decimal _weight = .05m;             ///Percentage van portfolio dat je wilt investeren
        
        private decimal _targetPercent = .01m;        //10%
        private decimal _stopPercent = .04m;        //verkopen bij de 2% verlies
        
        int _maxPosition = 1000;                    // Max USD invested
        int _minPosition = 100;                        // min USD needed to invest.
        
        public decimal _usd;                            //Amount of USD in our Cashbook.
        
        Maximum _maxExchange;
        Minimum _minExchange;
        

  
        //PROGRAMMA VARIABELEN
        public  decimal _price;
        public decimal _holding;            //Het aantal Ether we in onze portfolio hebben zitten.
        public string _baseSymbol;            //vertegenwoordigt de basesymbool dat we houden ETH
        
        
        
        public decimal _targetPrice;
        public decimal _stopPrice;

        public decimal _koers;
        
  
        
        //INITIALIZE BLOCK
        public override void Initialize()
        {
            SetStartDate(2017, 1, 1); 
            SetEndDate(2017, 1, 10);
            SetCash(_startingCash); 
    
            
            var _crypto = AddCrypto(_ticker, Resolution.Minute);
            _baseSymbol = _crypto.BaseCurrencySymbol;
            
            int _minutesOfTrading = 1440;
            _maxExchange = MAX(_ticker, _minutesOfTrading, Resolution.Minute);
            _minExchange = MIN(_ticker, _minutesOfTrading, Resolution.Minute);
            
            SetWarmUp(_minutesOfTrading, Resolution.Minute);
            
            SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
        }
        
        

        // ON DATA BLOCK (waar bestanden/data binnenkomt in het programma)
        public override void OnData(Slice data)
        {
            if (!_minExchange.IsReady) return;
            decimal _factor = (((_maxExchange- _minExchange)/2)/_maxExchange)*100;
            decimal _average = (_maxExchange / _minExchange);
            
            _price = data[_ticker].Price;
               
               
               
            
            if (!Portfolio.Invested && _factor >=3)
            {
            SetHoldings(_ticker, _weight);   // om een order te maken ==>percentage van portfolio dat je wilt investeren
            //Debug("Purchased Stock");        // Als het order gemaakt is word dit bevestigd door de debug
            //Log($"{_maxExchange}");
           
           _targetPrice = _price + (_price * _targetPercent);        //Bepalen welke verkoopprijs bij winst (huidige prijs + 10%)
           _stopPrice = _price - (_price * _stopPercent);            //bepalen welke verkoopprijs bij verlies (huidige - 2%)
            }
            
            if (Portfolio.Invested)
            {
                _holding = Portfolio.CashBook[_baseSymbol].Amount;
                
                if(_price >= _targetPrice)
                {
                    Sell(_ticker, _holding);
                }
                
                if(_price < _stopPrice)
                {
                    Sell(_ticker, _holding);
                }
                
            }
            
        }

    }
}