Topics
Replies
xabbu
31 Aug 2021, 09:28
Björn, if I get your problem right, you can't see all values, only the first few ones. But the highlighted section shows all values, right? It seems that you have unintenically shortetd the message field, as shown on your screenshoot. Go to the dotted line right next to "message", click and drag the line to the right. More values will be visible. Regards,
@xabbu
xabbu
09 Mar 2021, 11:52
Thank you Panagiotis,
I have done so with success and, as promised, I have published the TDFI indicator,new for cTrader - but wellknown on other platforms. I would be very happy if you have the time, take a look and let me know if and how I can improve it for me and the cTrader community. Kindest regards,
@xabbu
xabbu
01 Mar 2021, 17:48
( Updated at: 21 Dec 2023, 09:22 )
Panagiotis, thank you for taking care!
The code does nothing and was only meent to give me access and an understanding for the function.
What I want to do:
if the last fractal was above (signaling a down trend) I want to take only short trades.
if it was below only long trades.
I would like to use fractals as a kind of filter to prevent unwanted trade direction like here in this picture:
the fractal at the left should prevent me from taking the circeled long trade...
@xabbu
xabbu
01 Mar 2021, 14:40
Thank you, Panagiotis!
I have never before worked with NaN and it seems I cant get it to work:
if (double.IsNaN(_fractals.UpFractal.LastValue))
{
Print("Down: " + _fractals.DownFractal.LastValue);
}
if (double.IsNaN(_fractals.DownFractal.LastValue))
{
Print("Down: " + _fractals.DownFractal.LastValue);
}
Can you point me in the right direction, please...?
Kindest regards,
@xabbu
xabbu
24 Feb 2021, 10:51
Dear Panagiotis,
yes thank you very much, I have done so and I get the correct messages, if an operation is ended successful or with an error. Works like a charm!
But I`m adressing the meantime, BEFORE the callback comes back with a result. I need to know if an operation is ongoing to decide, if another trade is initiatetd.
Best regards,
@xabbu
xabbu
11 Dec 2020, 11:20
Sorry Panagiotis,
I don't get it. What should I do / modify? Even if I use
I will get the message for ALL positions open, not only for the pair where the TP has occured. I have no idea anymore - what do I'm doing wrong here?
private void OnPositionsClosed(PositionClosedEventArgs args)
{
if (args.Reason == PositionCloseReason.TakeProfit)
{
foreach (var _pos in Positions)
{
if (_pos.SymbolName == Symbol.Name)
{
//ModifyPositionAsync(_pos, _pos.EntryPrice, _pos.TakeProfit);
ModifyPosition(_pos, _pos.EntryPrice, _pos.TakeProfit);
SendMessage(_serverName + " / " + _brokerName + " / " + Account.Number + "\n" + SymbolName + " closed by TakeProfit " + TimeInUtc);
}
}
}
}
@xabbu
xabbu
10 Dec 2020, 13:51
( Updated at: 10 Dec 2020, 13:53 )
Dear Panatiogis,
I implemented your suggested solution a few weeks ago. It's works great. I would like to learn and gain my understanding in cTrader programming, so I would like to ask you a followup question to your solution:
Instead of constructing an own method
private void _dailyBars_BarOpened(BarOpenedEventArgs obj)
{
_allowTrading = true;
}
would placing the "_allowTrading = true;" in the onBar method of the cBot works the same?
Why did you choose your solution instead of using the already existing onBar method? Is there any kind of difference or unwanted side effects when using onBar?
on a daily timeframe, I have to add
Kindest regards,
@xabbu
xabbu
10 Dec 2020, 13:44
Dear Panagiotis,
I have found (?) this solution to my problem:
if (args.Reason == PositionCloseReason.StopLoss)
{
foreach (var _hist in History)
{
if (_hist.SymbolName == SymbolName && _hist.ClosingTime >= Time.Date)
{
SendMessage(_serverName + " / " + _brokerName + " / " + Account.Number + "\n" + SymbolName + " closed by StopLoss " + _hist.ClosingTime);
}
}
}
What do you think, could this be the right solution? Or do you recommend another and more elegant way...?
Kindest regards
@xabbu
xabbu
10 Dec 2020, 12:13
( Updated at: 21 Dec 2023, 09:22 )
Hey Panagiotis,
the code works, it sends a message if a position is closed.
The problem is, I have 35 instances running on that code, and when an position is closed due to a stoploss in ONE instance, EVERY instance sends this message, even if there are no open or closed positions...
@xabbu
xabbu
23 Nov 2020, 11:22
Dear Panagiotis,
I'm so greatfull for your knowledge and the ability to share it here - without your kind support my journey with cTrader, which I started 4 months ago, have not been possible. Today, my cBot has more than 1000 lines of code (I had to learn a little coding first) - I will implemet your suggestions imidiatly...
Kindest regards,
@xabbu
xabbu
12 Oct 2021, 14:28
no I didn’t - did you ever experienced such a behavior and discrepancy?
@xabbu