Overall Statistics
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 OnData(Slice data) 
        {
        	
        	// slice has lots of useful information
        	//if (!data.ContainsKey("EURUSD")) return;
        	//Ticks theticks = data.Ticks;
        	//Plot("Renko", "Buy", data["EURUSD"].Price);
        }
        
        public override void  OnEndOfAlgorithm() 
        { 
         
       Liquidate();	

        
        }
        
        
    }



    }