<UserControl x:Class="TradeBlotter.Views.MACDView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"                           
             xmlns:dc="clr-namespace:TradeBlotter.UIUtils"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding Path=BusyIndicator}" BusyContent="Generating MACD...">
    <Grid  Background="LightGray">
        <DockPanel>
            <Grid Margin="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="6" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="3" />
                    <RowDefinition Height="30" />
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
                <Label Content="Watch List" HorizontalAlignment="Left" ></Label>
                <ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
                <!--<Label Content="Symbol:" HorizontalAlignment="Left" Target="{Binding ElementName=tradeDateLbl}" ></Label>-->
                <Label Content="Symbol:" HorizontalAlignment="Left" ></Label>									
                <ComboBox x:Name="symbolCmb" ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
								<ComboBox.ItemsPanel>
									<ItemsPanelTemplate>
										<VirtualizingStackPanel/>
									</ItemsPanelTemplate>
								</ComboBox.ItemsPanel>
						</ComboBox>
                <Label Content="Day Count" HorizontalAlignment="Left"  ></Label>
                <ComboBox ItemsSource="{Binding Path=DayCounts, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDayCount, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
                <Button Margin="0,2" Content="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></Button>
                <CheckBox Margin="0,2" Content="Legend Visible" HorizontalAlignment="Left" IsChecked="{Binding Path=CheckBoxLegendVisible, Mode=TwoWay}"></CheckBox>
                </StackPanel>
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="3" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

            <d3:ChartPlotter Background="WhiteSmoke" Grid.Row="0" Grid.Column="0 " Name="MACDSlow" Margin="10,10,20,10" LegendVisibility="Hidden" dc:ChartPlotterLegendBehavior.LegendVisibleProperty="{Binding Path=LegendVisible}" d3:Viewport2D.UsesApproximateContentBoundsComparison="False" >
            <d3:ChartPlotter.MainHorizontalAxis>
            <d3:HorizontalDateTimeAxis Name="dateAxisSlow"/>
            </d3:ChartPlotter.MainHorizontalAxis>
            <d3:ChartPlotter.MainVerticalAxis>
            <d3:VerticalIntegerAxis Name="countAxisSlow"/>
            </d3:ChartPlotter.MainVerticalAxis>
            <d3:LineGraph d3:NewLegend.Description="Signal" DataSource="{Binding Path=SignalSlow}" Stroke="Red" StrokeThickness="2" />
            <d3:LineGraph d3:NewLegend.Description="MACD" DataSource="{Binding Path=MACDSlow}" Stroke="Blue"  StrokeThickness="2" />
            <d3:CursorCoordinateGraph Name="cursorGraphMACDSlow" dc:CoordinateGraphBehavior.XTextMappingProperty="MM/dd/yyyy" LineStrokeThickness="1"/>  
            <!--<d3:AxisCursorGraph></d3:AxisCursorGraph>-->

						<d3:MarkerPointsGraph x:Name="MACDSlowWeakBuy" DataSource="{Binding MACDSlowWeakBuy}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="Green" Orientation="up" Size="9">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
						<d3:MarkerPointsGraph x:Name="MACDSlowStrongBuy" DataSource="{Binding MACDSlowStrongBuy}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="Green" Orientation="up" Size="17">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
						<d3:MarkerPointsGraph x:Name="MACDSlowWeakSell" DataSource="{Binding MACDSlowWeakSell}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="red" Orientation="down" Size="9">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
						<d3:MarkerPointsGraph x:Name="MACDSlowStrongSell" DataSource="{Binding MACDSlowStrongSell}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="red" Orientation="down" Size="17">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
						<d3:Header FontFamily="Arial" FontSize="12" Content="{Binding Path=TitleSlow}"/>
            <d3:VerticalAxisTitle FontFamily="Arial" Content="Signal"/>
            <d3:HorizontalAxisTitle FontFamily="Arial" Content="Date" />
            </d3:ChartPlotter>
							
            <d3:ChartPlotter Background="WhiteSmoke" Grid.Row="0" Grid.Column="2" Name="MACDFast" Margin="10,10,20,10" LegendVisibility="Hidden" dc:ChartPlotterLegendBehavior.LegendVisibleProperty="{Binding Path=LegendVisible}" d3:Viewport2D.UsesApproximateContentBoundsComparison="False" >
            <d3:ChartPlotter.MainHorizontalAxis>
            <d3:HorizontalDateTimeAxis Name="dateAxisFast"/>
            </d3:ChartPlotter.MainHorizontalAxis>
            <d3:ChartPlotter.MainVerticalAxis>
            <d3:VerticalIntegerAxis Name="countAxisFast"/>
            </d3:ChartPlotter.MainVerticalAxis>
            <d3:LineGraph d3:NewLegend.Description="Signal" DataSource="{Binding Path=SignalFast}" Stroke="Red" StrokeThickness="2" />
            <d3:LineGraph d3:NewLegend.Description="MACD" DataSource="{Binding Path=MACDFast}" Stroke="Blue"  StrokeThickness="2" />
            <d3:CursorCoordinateGraph Name="cursorGraphMACDFast" dc:CoordinateGraphBehavior.XTextMappingProperty="MM/dd/yyyy" LineStrokeThickness="1"/>  
            <!--<d3:AxisCursorGraph></d3:AxisCursorGraph>-->
							
						<d3:MarkerPointsGraph x:Name="MACDFastWeakBuy" DataSource="{Binding MACDFastWeakBuy}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="Green" Orientation="up" Size="9">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
						<d3:MarkerPointsGraph x:Name="MACDFastStrongBuy" DataSource="{Binding MACDFastStrongBuy}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="Green" Orientation="up" Size="17">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
						<d3:MarkerPointsGraph x:Name="MACDFastWeakSell" DataSource="{Binding MACDFastWeakSell}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="red" Orientation="down" Size="9">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
						<d3:MarkerPointsGraph x:Name="MACDFastStrongSell" DataSource="{Binding MACDFastStrongSell}">
							<d3:MarkerPointsGraph.Marker>
								<d3:TrianglePointMarker Fill="red" Orientation="down" Size="17">
									<d3:TrianglePointMarker.Pen>
										<Pen Brush="Black" Thickness="1"/>
									</d3:TrianglePointMarker.Pen>
								</d3:TrianglePointMarker>
							</d3:MarkerPointsGraph.Marker>
						</d3:MarkerPointsGraph>
							
						<d3:Header FontFamily="Arial" FontSize="12" Content="{Binding Path=TitleFast}"/>
            <d3:VerticalAxisTitle FontFamily="Arial" Content="Signal"/>
            <d3:HorizontalAxisTitle FontFamily="Arial" Content="Date" />
            </d3:ChartPlotter>
            </Grid>                             
        </DockPanel>
    </Grid>
  </wpfx:BusyIndicator>
</UserControl>
