Topics
Replies
mohsabry.ms
21 Dec 2021, 22:50
RE:
Hi,
Did you mean that " if (Server.TimeInUtc.TimeOfDay.TotalMinutes == 1)"
or What?
@mohsabry.ms
mohsabry.ms
21 Dec 2021, 00:33
RE:
Thanx , But I need a time function to run condition at certain time everyday and stop at another certain time also everyday
@mohsabry.ms
mohsabry.ms
18 Nov 2021, 11:59
RE:
amusleh said:
Hi,
Did you checked the API references example: cAlgo API Reference - IndicatorDataSeries Interface (ctrader.com)
You have to store your calculation result inside an IndicatorDataSeries, then you can use that data series on your cBots.
Thank you for your advice it works well
Regards,
@mohsabry.ms
mohsabry.ms
15 Nov 2021, 14:47
RE:
PanagiotisCharalampous said:
Hi mohsabry.ms,
To be able to access your indicator's values from a cBot, you first need to expose them in a public variable, preferably an IndicatorDataSeries.
Best Regards,
Panagiotis
Appreciate your valuable help,
Forgive me as just a begineer
But I tired trying expose "a" variable to be an output as a IndicatorDataSeries.
The calculation made as a series not index
I search how to make series type deals with IndicatorDataSeries but I really can't find a way
private void LinearRegression(DataSeries series)
// Linear regresion
double sum_x = 0, sum_x2 = 0, sum_y = 0, sum_xy = 0;
int start = series.Count - Bars;
int end = series.Count - 1;
for (int i = start; i <= end; i++)
{
sum_x += 1.0 * i;
sum_x2 += 1.0 * i * i;
sum_y += series[i];
sum_xy += series[i] * i;
}
double a = (Bars * sum_xy - sum_x * sum_y) / (Bars * sum_x2 - sum_x * sum_x);
}
and there is no output
Thank you in Advance
Regards,
@mohsabry.ms
mohsabry.ms
06 Nov 2021, 01:29
RE: RE: Thank you for helping
Hi,
If I wanna to choose from history some specific closed trades that i labeled it before as "sell_today"
how to modify this code to select them only;
var netProfit = History.Sum(trade => trade.NetProfit);
Forgive me I'm just a beginner
Thank you in advace
Best Regards,
@mohsabry.ms
mohsabry.ms
05 Nov 2021, 14:41
RE: Thank you for helping
amusleh said:
Hi,
You can use history to sum the net profit of all your closed positions (trades):
var netProfit = History.Sum(trade => trade.NetProfit);
To get net profit of all your open positions you can use Positions:
var netProfit = Positions.Sum(position => position.NetProfit);
It works well,
Appreciate your help
Regards,
@mohsabry.ms
mohsabry.ms
23 Dec 2021, 12:26
RE: RE: RE:
amusleh said:
Appreciate your help
Thanx Alot
@mohsabry.ms