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 kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    33 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    29 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    36 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    33 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    143 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X