Topics
Replies
akbarlotfi15168
13 Jul 2021, 09:43
Hello
You should first write the indicator then call it in your robot with
Your IndicatorNameInRobot = Indicators.GetIndicator<YourIndicatorName>(YourIndicatorFirstParameter,YourIndicatorSecondParameter);
Then Below the Ontick()
double YourIndicatorFirstNeededOutput = IndicatorNameInRobot.YourIndicatorOutputName.Last();
Your mistake is you use getindicator in your indicator with the it's namespace in itself.
@akbarlotfi15168
akbarlotfi15168
09 Apr 2021, 21:33
( Updated at: 09 Apr 2021, 21:44 )
RE:
amusleh said:
Hi,
Whenever you change a parameter of an indicator, load more data, or get disconnected and re-connected cTrader re-initializes the indicator and your indicator have to re-calculate everything from start.
The way cTrader works is much better than other platforms, because it doesn't force developers to manage events and do all the work of updating the indicator outputs for new data or re-adjusting the indicator already calculated data, but yes it consumes more processing power.
To solve the CPU processing power consumption issue, you can write your indicator calculated outputs data on a file and then when indicator initializes check if the file exist, if there is a cache file for indicator data fill the outputs by loading the file data instead of re-calculating the data and escape the bars until you reach the bars that aren't in your file.
I think I should add an event to give me a point when more bar loaded to chart. At that time I nead some method to count hove much bar loaded if calgo has this. Then I should use calculate from index till index- bars loaded if current bar is 0 and we go Left hand side till for example 3500. and if current bar is 3500 and we go Left till 0 I shoul calculate from (index-(index-barsLoaded)) till 0.But I dont Know cAlgo do what type of it . I think they use 0 for current bars.
public int LoadMoreHistory()
I think it is helpful. can you give me any example to it returns bars loaded?
@akbarlotfi15168
akbarlotfi15168
30 Jul 2021, 17:34
Tank You
Tank You for useful information I read a sample in forum
It solved my problem . I write the code like this:
var trendLines = Chart.FindAllObjects<ChartTrendLine>();
foreach (var trendLine in trendLines)
{
var chartTrendLine = trendLine as ChartTrendLine;
_chartTrendLine = chartTrendLine;
}
var BarIndex = MarketSeries.Close.Count - 1;
double trendLineLastValue = _chartTrendLine.CalculateY(BarIndex);
But I think there is something better that I have used for BarIndex .Can you help me?
@akbarlotfi15168