Topics
Replies
DelFonseca
02 Jul 2019, 21:10
RE:
Hello,
How can i call custom indicator for multi-timeframe? im trying calling Renko (https://ctrader.com/algos/indicators/show/1086) with the code below but it doesn't work:
AUDCADseries = MarketData.GetSeries("AUDCAD", TimeFrame.Hour);
AUDCADrenko = Indicators.GetIndicator<Renko>(AUDCADseries, RenkoPips, BricksToShow, 3, "SeaGreen", "Tomato");
Thank you!!
@DelFonseca
DelFonseca
02 Jul 2019, 21:09
Hello,
How can i call custom indicator for multi-timeframe? im trying calling Renko (https://ctrader.com/algos/indicators/show/1086) with the code below but it doesn't work:
AUDCADseries = MarketData.GetSeries("AUDCAD", TimeFrame.Hour);
AUDCADrenko = Indicators.GetIndicator<Renko>(AUDCADseries, RenkoPips, BricksToShow, 3, "SeaGreen", "Tomato");
Thank you!!
@DelFonseca
DelFonseca
02 Jul 2019, 21:09
Hello,
How can i call custom indicator for multi-timeframe? im trying calling Renko (https://ctrader.com/algos/indicators/show/1086) with the code below but it doesn't work:
AUDCADseries = MarketData.GetSeries("AUDCAD", TimeFrame.Hour);
AUDCADrenko = Indicators.GetIndicator<Renko>(AUDCADseries, RenkoPips, BricksToShow, 3, "SeaGreen", "Tomato");
Thank you!!
@DelFonseca
DelFonseca
02 Jul 2019, 21:05
Custom indicator multi timeframe
Hello,
Im using Renko indicator (https://ctrader.com/algos/indicators/show/1086) on a cBot for multi timeframe but i cant get the if brick is up or down in multi timeframe, only in single pair.
Where am i going wrong?
AUDCADseries = MarketData.GetSeries("AUDCAD", TimeFrame.Hour);
AUDCADrenko = Indicators.GetIndicator<Renko>(AUDCADseries, AUDCADrenko.Close, RenkoPips, BricksToShow, 3, "SeaGreen", "Tomato");
Thank you
@DelFonseca
DelFonseca
24 Apr 2019, 20:17
Hi Panagiotis,
Im trying to count how many buy stop pending orders i have.
I have 6 pending orders, with order type "Buy Stop"and the code below returns 1, not 6.
_LongPendingOrdersCount = PendingOrders.Where(posPendingLongCount => posPendingLongCount.Label == LabelBuy).Where(posPendingLongCount => posPendingLongCount.OrderType == PendingOrderType.Stop && posPendingLongCount.TradeType == TradeType.Buy).Count();
Can you help me please ?
Thank you so much
@DelFonseca
DelFonseca
06 Jan 2019, 03:08
go to your Documents\cAlgo\Sources\ and share/sell only the algo file.
Test duplicating one, change the name an install it. you cant have access to the code.
@DelFonseca
DelFonseca
06 Jan 2019, 02:58
Hey,
You need add your parameter "CustomName" to the trading syntax, not to the string label declaration.
Here you only declarate a name to your label:
private const string Label = "test-01DE";
Here you add the parameter "CustomName":
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, Label + CustomName);
After that just add 2 cbots with diff "CustomName", you can add to the same chart.
I hope i can have helped you and im sory for my English.
@DelFonseca
DelFonseca
03 Jan 2019, 23:30
If someone needs the solucion:
using System.Timers;
(...)
int lastHour;
(...)
protected override void OnStart()
{
var aTimer = new System.Timers.Timer(1000); //1000 = One second. (use less to add precision, use more to consume less processor time
lastHour = DateTime.Now.Hour;
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
}
private void OnTimedEvent(object source, ElapsedEventArgs e)
{
if (lastHour < DateTime.Now.Hour || (lastHour == 23 && DateTime.Now.Hour == 0))
{
lastHour = DateTime.Now.Hour;
YourImportantMethod(); // Call The method with your important staff..
}
}
@DelFonseca
DelFonseca
03 Jan 2019, 20:21
Hi Paul,
That's a good ideia. I will creat a timer to export hourly.
Thank you again!
@DelFonseca
DelFonseca
03 Jan 2019, 08:55
Hi Paul Hayes,
Thank you very much for your reply.
I already have here in my files, this code also doesnt do what i want.
I currently have exporting on OnBar(1 minute timeframe) wich is where the strategy runs, but i want to export hourly.
Thank you again.
@DelFonseca
DelFonseca
17 Dec 2018, 20:33
Hi Panagiotis,
Thank you so much. Perfect.
Merry Christmas and Happy New Year. Cheers
@DelFonseca
DelFonseca
15 Dec 2018, 20:47
Hi,
This code make sense to close all trades when sum of account pips by layer are >= -100 or >= 300 ?
Thank you
private void PermissionToClose()
{
//CONDITIONS TO CLOSE LONG POSITIONS
int? a = null;
int? b = null;
foreach (var LongPositions in Positions.FindAll(LabelBuy))
a++;
foreach (var LongPositions in Positions.FindAll(LabelBuy))
if (LongPositions.Pips >= 300 || LongPositions.Pips <= -100)
b++;
if (a == b)
foreach (var LongPositions in Positions.FindAll(LabelBuy))
{
ClosePositionAsync(LongPositions);
}
//CONDITIONS TO CLOSE SHORT POSITIONS
int? c = null;
int? d = null;
foreach (var ShortPositions in Positions.FindAll(LabelSell))
c++;
foreach (var ShortPositions in Positions.FindAll(LabelSell))
if (ShortPositions.Pips >= 300 || ShortPositions.Pips <= -100)
d++;
if (c == d)
foreach (var ShortPositions in Positions.FindAll(LabelSell))
{
ClosePositionAsync(ShortPositions);
}
}
@DelFonseca
DelFonseca
08 Dec 2018, 19:48
Thank you very much Panagiotis, It's perfect. You'r the greatest.
Best Regards!
@DelFonseca
DelFonseca
21 Sep 2018, 20:36
RE:
afhacker said:
For double generic collections you can use this method:
public static double Correlation(IEnumerable<double> x, IEnumerable<double> y) { double xSum = x.Sum(); double ySum = y.Sum(); double xSumSquared = Math.Pow(xSum, 2); double ySumSquared = Math.Pow(ySum, 2); double xSquaredSum = x.Select(value => Math.Pow(value, 2)).Sum(); double ySquaredSum = y.Select(value => Math.Pow(value, 2)).Sum(); double xAndyProductSum = x.Zip(y, (value1, value2) => value1 * value2).Sum(); double n = x.Count(); return ((n * xAndyProductSum) - (xSum * ySum)) / Math.Sqrt(((n * xSquaredSum) - xSumSquared) * ((n * ySquaredSum) - ySumSquared)); }
Thank you very much for your feedback.
Please tell me how I can make correlation value print.
@DelFonseca
DelFonseca
22 Jun 2018, 21:06
Thank you for your feedback.
I'm not very good with English. The problem is that the code below doesnt cheeck the strategy (crossing moving averages) when a trade comes from the martingale.
private void ExecuteOrder(long volume, TradeType tradeType)
{
var result = ExecuteMarketOrder(tradeType, Symbol, volume, label2, sl2, tp2);
if (result.Error == ErrorCode.NoMoney)
Stop();
}
I wan the position of the martingale's also open at the crossing of moving averages.
Thank you
@DelFonseca
DelFonseca
19 Jun 2018, 02:50
Hi
When he starts the martingale, he doesnt check the strategy. Hitting the stoploss he open a new order without check if strategy = true.
How do I check the strategy again and if there is true, open martingale order?
thank you
@DelFonseca
DelFonseca
08 Jul 2019, 20:26
RE:
Panagiotis Charalampous said:
Cheers
@DelFonseca