Overall Statistics
Total Trades
10001
Average Win
0.00%
Average Loss
0.00%
Compounding Annual Return
-0.256%
Drawdown
0.200%
Expectancy
-0.052
Net Profit
-0.157%
Sharpe Ratio
-3.825
Probabilistic Sharpe Ratio
0.000%
Loss Rate
51%
Win Rate
49%
Profit-Loss Ratio
0.92
Alpha
-0.002
Beta
-0.001
Annual Standard Deviation
0.001
Annual Variance
0
Information Ratio
-2.705
Tracking Error
0.104
Treynor Ratio
2.171
Total Fees
$0.00
namespace QuantConnect.Algorithm.CSharp
{
    public class RenkoAlgorithm : QCAlgorithm
    {
        RenkoBar prevDirection=null;
        int changes=0;
        int bricks=1, allBricks=0;
        int noDelta=0;
        string pear="EURUSD";
        int startAmount=1000000;
        decimal parcent=0.2m;
        decimal amount=0;
        public override void Initialize() 
        {
            // cash allocation
            SetCash(startAmount);  
            SetStartDate(2013, 01, 01);  
            SetEndDate(2014, 01, 01);
            //var renkoATR = ATR("EURUSD",14, MovingAverageType.Simple, Resolution.Daily);
            AddSecurity(SecurityType.Forex, pear, Resolution.Minute); //Minute, Second or Tick
            Securities[pear].FeeModel = new ConstantFeeModel(0m);

            var renkoClose = new RenkoConsolidator(0.001m);
    
            renkoClose.DataConsolidated += (sender, consolidated) =>
            {
                // call event handler for renko data
                HandleRenkoClose(consolidated);   
            };
            SubscriptionManager.AddConsolidator(pear, renkoClose);
            var stockPlot = new Chart("Renko");
            var buyOrders = new Series("Buy", SeriesType.Bar, 0);
            stockPlot.AddSeries(buyOrders);
            AddChart(stockPlot);
        }
     
        private void HandleRenkoClose(RenkoBar data)
        {
        	Liquidate();
        	MarketOrder(pear,-5000);
        }

        public override void  OnEndOfAlgorithm() 
        { 
        	Liquidate();    
        }
    }
}