Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Replay + multi-instruments + plotting ... crash

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Market Replay + multi-instruments + plotting ... crash

    Hello,

    if you use the Plot method inside of OnMarketData, the MarketReplay crashes when is rewinded to the begining.

    Only occurs with multi-instrument. With one single instrument works ok.

    If you don't rewind, no crashes.

    The code:
    Code:
    protected override void Initialize()
            {
    			Add( "$GBPUSD", BarsPeriod.Id, BarsPeriod.Value );	// Instrumento secundario: GBPUSD
    			
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));
                
    			CalculateOnBarClose	= false;
                Overlay				= false;
    			BarsRequired		= 20;
            }
    
    		protected override void OnMarketData( MarketDataEventArgs e )
    		{
    			switch (BarsInProgress)
    			{
    				case 0:
    		            Plot0.Set(Close[0]);
    					break;
    				case 1:
    		            Plot1.Set(Close[0]);
    					break;
    			}
    		}
    		
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
            }
    Attached Files
    Last edited by cls71; 04-05-2010, 03:12 AM.

    #2
    cls71, it's unfortunately not supported to plot from OnMarketData(). You could set variables there and then plot those in the OnBarUpdate() of your code.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    421 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    279 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    238 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    325 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    288 views
    0 likes
    Last Post CarlTrading  
    Working...
    X