Overall Statistics Total Trades0Average Win0%Average Loss0%Compounding Annual Return0%Drawdown0%Expectancy0Net Profit0%Sharpe Ratio0Loss Rate0%Win Rate0%Profit-Loss Ratio0Alpha0Beta0Annual Standard Deviation0Annual Variance0Information Ratio0Tracking Error0Treynor Ratio0Total Fees\$0.00
```using System;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Basic template algorithm simply initializes the date range and cash. This is a skeleton
/// framework you can use for designing an algorithm.
/// </summary>

public class BasicTemplateAlgorithm : QCAlgorithm
{

private int barcount = 0;
private decimal barclose = 0;
private decimal barlow = 0;
private decimal barhigh = 0;
private decimal barlowest = (decimal)999999.0;
private decimal barhighest = (decimal)0.0;
private decimal HH1 = 0;
private decimal HH2 = 0;
private decimal LL1 = 0;
private decimal LL2 = 0;
private bool is_high = true;
private bool is_low = false;
private int HLbarcount = 0;

DateTime barlowestDateTime;
DateTime barhighestDateTime;

//  TimeSeries HL;
private String symbol = "EURUSD";

public override void Initialize()
{
SetStartDate(2017, 10, 3);
SetEndDate(2017, 10, 5);
var chart = new Chart("Plotter");
//					PlotIndicator("EURUSD", spyClose, emaFast, emaSlow);
// HL = new TimeSeries("High-Low", Color.White);
// Draw(HL, 0);

}

{
Plot("Plotter", symbol+"H", bar[symbol].High);
Plot("Plotter", symbol+"L", bar[symbol].Low);
if ((bar[symbol].Close > 0) && (bar[symbol].High > 0) && (bar[symbol].Low > 0) && (bar[symbol].Open > 0))
{
/*
if (Mode != StrategyMode.Simulation)
{
}
*/
barcount++;
HLbarcount++;
barclose = bar[symbol].Close;
barhigh = bar[symbol].High;
barlow = bar[symbol].Low;

if (barcount > 1)
{
if ((barlow) < barlowest)
{
barlowest = barlow;
barlowestDateTime = bar[symbol].EndTime;
}

if ((barhigh) > barhighest)
{
barhighest = barhigh;
barhighestDateTime = bar[symbol].EndTime;
}
}

{
if ((HLbarcount > 3) && (is_low) && (Bars[0].High > Bars[3].High) && (Bars[0].Low > Bars[1].Low) && (Bars[0].Low > barlowest))
{
LL2 = LL1;
LL1 = barlowest;
if (LL1 != LL2)
{
is_high = true;
is_low = false;
Plot("Plotter", "HH", barlowest);

barhighest = Math.Max(Math.Max(Math.Max(Bars[0].High,Bars[1].High),Bars[2].High),Bars[3].High);
barhighestDateTime = bar[symbol].EndTime;
HLbarcount = 0;
HH1 = 0;
HH2 = 0;
//               Log("{0}     LL1 = {1}     barhighest = {2}", barlowestDateTime, LL1, barhighest);
}
}

if ((HLbarcount > 3) && (is_high) && (Bars[0].Low < Bars[3].Low)&& (Bars[0].High < Bars[1].High) && (Bars[0].High < barhighest))
{
HH2 = HH1;
HH1 = barhighest;
if (HH1 != HH2)
{
is_low = true;
is_high = false;
Plot("Plotter", "HH", barhighest);
//barlowest =  Bars.LowestLow(4);
barlowest = Math.Min(Math.Min(Math.Min(Bars[0].High,Bars[1].High),Bars[2].High),Bars[3].High);

barlowestDateTime = bar[symbol].EndTime;
HLbarcount = 0;
LL1 = 0;
LL2 = 0;
//     Log("{0}     HH1 = {1}     barlowest = {2}", barhighestDateTime, HH1, barlowest);
}
}

}

}
else
{
//    Log("Instrument:    {0},       Date/Time:     {1}", Instrument, bar.DateTime);
}
}
}
}```