backtest chart freeze
            
                 19 Apr 2024, 14:17
            
                    
after i added this part, the chart freezes when the spread is not 0
else if (args.Reason == PositionCloseReason.TakeProfit && Symbol.Spread == 0)
            {
                while (Symbol.Spread != 0)    //the new part that i added is from here
                {
                    Thread.Sleep(1000);
                }                             // to here
                
                _lastVolume = 1000;
                ExecuteMarketOrder(_lastTradeType, SymbolName, _lastVolume, "SinglePositionBot", StopLossPips, TakeProfitPips);
                _positionOpened = true;
            }Replies
                     nafewhossain03
                     20 Apr 2024, 18:27
                                            ( Updated at: 20 Apr 2024, 18:33 )
                                    
RE: backtest chart freeze
PanagiotisCharalampous said:
Hi there,
Your problem is here
while (Symbol.Spread != 0) //the new part that i added is from here { Thread.Sleep(1000); }If you prevent the cBot from receiving new ticks, the spread will never change.
Best regards,
Panagiotis
the problem is the chart, it should not freeze. if i made any mistake in the code it should still continue the backtest with its errors, by the way it freezes even if i remove the backtesting chart view
oh and i also removed “&& symbol.spread == 0” from the else if line
@nafewhossain03
                     nafewhossain03
                     21 Apr 2024, 22:15
                                    
RE: backtest chart freeze
PanagiotisCharalampous said:
Hi there,
Your problem is here
while (Symbol.Spread != 0) //the new part that i added is from here { Thread.Sleep(1000); }If you prevent the cBot from receiving new ticks, the spread will never change.
Best regards,
Panagiotis
i now understand, thank you very much
@nafewhossain03

PanagiotisCharalampous
20 Apr 2024, 06:15
Hi there,
Your problem is here
If you prevent the cBot from receiving new ticks, the spread will never change.
Best regards,
Panagiotis
@PanagiotisCharalampous