Close All positions of related chart with pip value -20
Close All positions of related chart with pip value -20
13 Dec 2019, 06:13
Dear All,
I am new to Forex Trading, I don't have any knowledge on Cbot Coding. I was using a Cbot from this website, unfortunately I can't edit the code. So I am not able to set stop loss for my positions. So could you please help me with the code to close all positions when the pip value is -100.
For ex I have multiple symbols chart and positions open, Now I want to run this Cbot on particular chart say (XAUUSD) so that it closes all the XAUUSD positions with pip value is less than -100
If I want to close the positions of EURUSD, then I will run this Cbot on EURUSD Chart. Also please advice id there will be any problem if I run 2 cbots in the same chart or please let me know any other option
Replies
velu130486
13 Dec 2019, 11:15
RE:
PanagiotisCharalampous said:
Hi velu130486,
In order to help you, you will need to share the cBot code with us.
Best Regards,
Panagiotis
Hi Panagiotis,
I download the attached code from Internet, unfortunately I can'y view the source code. I am looking for similar type of code with Risk Management. This code itself working fine, but needs more margin otherwise account get washed out.
Also some time multiple orders are placed at same price in both the directions and I am not able to fix the problem. I am not able to attach that file. please advice
PanagiotisCharalampous
13 Dec 2019, 11:25
Hi velu130486,
If you do not have the cBot code then you can use the cBot below in parallel. This cBot will close all positions of the chart symbol that have loss bigger than the pips specified in the parameters
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
[Parameter(DefaultValue = 100)]
public double Pips { get; set; }
protected override void OnStart()
{
}
protected override void OnTick()
{
foreach (var position in Positions.Where(x => x.SymbolName == Symbol.Name))
{
if (position.Pips < -Pips)
{
position.Close();
}
}
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
Best Regards,
Panagiotis
@PanagiotisCharalampous
velu130486
13 Dec 2019, 11:43
RE:
PanagiotisCharalampous said:
Hi velu130486,
If you do not have the cBot code then you can use the cBot below in parallel. This cBot will close all positions of the chart symbol that have loss bigger than the pips specified in the parameters
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = 100)] public double Pips { get; set; } protected override void OnStart() { } protected override void OnTick() { foreach (var position in Positions.Where(x => x.SymbolName == Symbol.Name)) { if (position.Pips < -Pips) { position.Close(); } } } protected override void OnStop() { // Put your deinitialization logic here } } }
Best Regards,
Panagiotis
Hi Panagiotis,
Thanks for the code and I just tried it and works fine However it closes all the manual orders also..
Just curious to know is it possible to update the code to include function like Trailing stop in the same code to take the advantage to secure my profit. When I place the manual order I use Trailing stop, However in the Cbot I don't have that option.
PanagiotisCharalampous
13 Dec 2019, 11:50
Hi velu130486,
It will need some work to add these features in the cBot. You can consider posting a Job or contacting a Consultant to develop a single, tailor made cBot for you.
Best Regards,
Panagiotis
@PanagiotisCharalampous
velu130486
13 Dec 2019, 12:06
RE:
PanagiotisCharalampous said:
Hi velu130486,
It will need some work to add these features in the cBot. You can consider posting a Job or contacting a Consultant to develop a single, tailor made cBot for you.
Best Regards,
Panagiotis
Hi Panagiotis,
Actually I posted my requirement but there is no response. I search over the Internet and got the code suit my requirement but without risk management my account got washed out. So I request your support.
Thanks in Advance.
PanagiotisCharalampous
13 Dec 2019, 12:09
Hi velu130486,
Did you try contacting the consultants directly?
Best Regards,
Panagiotis
@PanagiotisCharalampous
velu130486
13 Dec 2019, 12:10
RE:
PanagiotisCharalampous said:
Hi velu130486,
Did you try contacting the consultants directly?
Best Regards,
Panagiotis
No, I don't find any contact informations. Anyhow I will have a look 1 more time
PanagiotisCharalampous
13 Dec 2019, 12:13
Hi velu130486,
I see that you posted something here and you got a response https://ctrader.com/jobs/764. Did you try contacting them?
Best Regards,
Panagiotis
@PanagiotisCharalampous
velu130486
13 Dec 2019, 12:23
RE:
PanagiotisCharalampous said:
Hi velu130486,
I see that you posted something here and you got a response https://ctrader.com/jobs/764. Did you try contacting them?
Best Regards,
Panagiotis
I already sent the email, infact I also registered in their website earlier but no response till date.
ClickAlgo
13 Dec 2019, 12:38
Hi,
Which email or name did you use as we have not recieved an email that we have not replied to. Which email address did you also send your message to?
Paul
@ClickAlgo
velu130486
20 Dec 2019, 11:08
RE:
PanagiotisCharalampous said:
Hi velu130486,
If you do not have the cBot code then you can use the cBot below in parallel. This cBot will close all positions of the chart symbol that have loss bigger than the pips specified in the parameters
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = 100)] public double Pips { get; set; } protected override void OnStart() { } protected override void OnTick() { foreach (var position in Positions.Where(x => x.SymbolName == Symbol.Name)) { if (position.Pips < -Pips) { position.Close(); } } } protected override void OnStop() { // Put your deinitialization logic here } } }
Best Regards,
Panagiotis
Hi Panagiotis,
Similar to the above code, could you please help me to create a Cbot which will modify the Take Profit and update trailing stop loss on Certain Pips movement. (i.e.) I am executing the trade with Take Profit 10 Pips, so I would like to do the modification on Take Profit and Trailing stop loss by +10 Pips.
PanagiotisCharalampous
20 Dec 2019, 11:18
Hi velu130486,
As I explained above, if you need help with custom development, you can consider posting a Job or contacting a Consultant to develop your cBot.
Best Regards,
Panagiotis
@PanagiotisCharalampous
velu130486
20 Dec 2019, 12:37
RE:
PanagiotisCharalampous said:
Hi velu130486,
As I explained above, if you need help with custom development, you can consider posting a Job or contacting a Consultant to develop your cBot.
Best Regards,
Panagiotis
Hi Panagiotis,
I am already in touch with 1 developer and the work is ongoing. In mean time I need this code to minimize my losses.
PanagiotisCharalampous
13 Dec 2019, 08:17
Hi velu130486,
In order to help you, you will need to share the cBot code with us.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous