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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    625 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    359 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    562 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    567 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X