The data is there because I'm writing it at the same time to an output window. Can you tell me what is out of whack with this? Any direction would be appreciated.
Safetrading
publicclass TestStrategy1 : Strategy
{
#region Variables
privateint myInput0 = 1;
double LastAsk = 0;
double LastBid = 0;
double myLast = 0;
double delta = 0;
double upvol = 0;
double downvol = 0;
#endregion
protectedoverridevoid Initialize()
{
CalculateOnBarClose = true;
Add(StrategyPlot(0));
Add(StrategyPlot(1));
StrategyPlot(0).Plots[0].Pen.Color = Color.Blue;
StrategyPlot(1).Plots[0].Pen.Color = Color.DeepSkyBlue;
StrategyPlot(0).PanelUI = 2;
StrategyPlot(1).PanelUI = 2;
upvol = 0;
downvol = 0;
}
protectedoverridevoid OnMarketData(MarketDataEventArgs e)
{
if (e.MarketDataType == MarketDataType.Last && e.Price >= GetCurrentAsk())
{
upvol = upvol + e.Volume;
Print("Up Vol " + upvol.ToString());
}
elseif (e.MarketDataType == MarketDataType.Last && e.Price >= GetCurrentBid())
downvol = downvol + e.Volume;
Print("Down Vol " + downvol.ToString());
StrategyPlot(0).Value.Set(upvol);
StrategyPlot(1).Value.Set(downvol);
Comment