Topics
08 Jan 2020, 13:02
 945
 3
17 Dec 2019, 13:23
 1533
 3
Replies

v.kredov
08 Jan 2020, 14:23 ( Updated at: 21 Dec 2023, 09:21 )

RE:

PanagiotisCharalampous said:

Hi v.kredov,

Your indicator throws an exception here

ResultClose.Count is 1 and you are trying to access index -1. You should fix this before we can proceed.

Best Regards,

Panagiotis 

Join us on Telegram

 

This line can be commented out, it is not critical. In the real chart, it does not swear, in backtest mode, execution does not reach this. Or we can use this filter

if(ResultClose.Count > 2 && Bars.ClosePrices.Count > 1)
                    Chart.DrawTrendLine("Point" + (Bars.ClosePrices.Count - 1).ToString(), Bars.ClosePrices.Count - 2, ResultClose[ResultClose.Count -2], Bars.ClosePrices.Count - 1, ResultClose[ResultClose.Count - 1], "Blue", 2);
 

 


@v.kredov

v.kredov
17 Dec 2019, 13:41 ( Updated at: 21 Dec 2023, 09:21 )

On the live chart, this error often appears when adding an indicator. When the number of indicator values ​​is not equal to the number of tool candles, despite the fact that this behavior always occurs when loading the history of the tool by scrolling the chart back.


@v.kredov