
Topics
Replies
PanagiotisCharalampous
12 Oct 2017, 16:41
RE: RE:
davideng5555 said:
Hi Panagiotis,
What to do when trying to edit a robot, and there is only this message.
'Source code is not available.'
Thank you very much
David.
This means that the cBot's creator did not provide the source code therefore you cannot edit the cBot
@PanagiotisCharalampous
PanagiotisCharalampous
12 Oct 2017, 14:55
Hi davideng5555,
Here it is :)
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class MULTIMARKETORDER : Robot { [Parameter("Lot Size", DefaultValue = 0.01)] public double lot { get; set; } [Parameter("Positions nr.", DefaultValue = 100)] public int nr { get; set; } [Parameter("Buy ?")] public bool buy { get; set; } [Parameter("Sell ?")] public bool sell { get; set; } [Parameter("Min TP")] public double MinTP { get; set; } [Parameter("Max TP")] public double MaxTP { get; set; } protected override void OnStart() { long volume = Symbol.QuantityToVolume(lot); if (buy) { for (int i = 0; i < nr; i++) ExecuteMarketOrder(TradeType.Buy, Symbol, volume); } if (sell) { for (int i = 0; i < nr; i++) ExecuteMarketOrder(TradeType.Sell, Symbol, volume); } } protected override void OnBar() { foreach (var position in Positions) { if (position.Pips > MinTP && position.Pips < MaxTP) { ClosePosition(position); } } } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
12 Oct 2017, 14:39
Hi
It depends where you want to make the check. If you want to make it on each candlestick change, try the following
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class MULTIMARKETORDER : Robot { [Parameter("Lot Size", DefaultValue = 0.01)] public double lot { get; set; } [Parameter("Positions nr.", DefaultValue = 100)] public int nr { get; set; } [Parameter("Buy ?")] public bool buy { get; set; } [Parameter("Sell ?")] public bool sell { get; set; } protected override void OnStart() { long volume = Symbol.QuantityToVolume(lot); if (buy) { for (int i = 0; i < nr; i++) ExecuteMarketOrder(TradeType.Buy, Symbol, volume); } if (sell) { for (int i = 0; i < nr; i++) ExecuteMarketOrder(TradeType.Sell, Symbol, volume); } } protected override void OnBar() { foreach (var position in Positions) { if (position.Pips > 5 && position.Pips < 20) { ClosePosition(position); } } } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
12 Oct 2017, 14:05
Hi davideng5555,
Try the following condition
if (position.Pips > 5 && position.Pips < 20) { ClosePosition(position); }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
12 Oct 2017, 09:23
Hi anjupeguforex@gmail.com,
You get this exception because you are trying to access an array item that does not exist. Before accessing a position in Positions using index You should always check that the index is within the range of the array. I propose to change checks like the following
if (poz[1] != null)
to
if (poz.Length > 1)
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
11 Oct 2017, 17:50
Hi zabarmel,
Thanks for the video. We tried this but we cannot reproduce it. We will forward it to the development team to investigate it further.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
11 Oct 2017, 15:48
Hi ycomp,
No nothing else has been depreciated. It is in our plans to inform you about all future Connect API changes via email. You can also check the Announcements section where we will put the relevant announcements.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
11 Oct 2017, 09:52
Hi Zjhehe,
Thanks for describing the issue you face. Could you please give us exact steps on how to reproduce what you see? We tried to reproduce this but we couldn't.
Best Regards,
Panagiots
@PanagiotisCharalampous
PanagiotisCharalampous
11 Oct 2017, 09:41
Hi ycomp,
ProtoPingReq has been depreciated. Please use ProtoOAPingReq.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
11 Oct 2017, 09:39
Dear irmscher9,
Thanks for your nice words:) If you google "cTrader Review" you will find many reviews of cTrader where you can share your opinion. However the best feedback for us is to see satisfied users of our products.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
11 Oct 2017, 09:34
Hi jaredthirsk,
We have reported the issue and will be fixed soon. Till then, as a workaround when it stucks on this webpage, you can try to relaunch application.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
11 Oct 2017, 09:33
Hi anjupeguforex@gmail.com,
You can access positions in many ways. Some of them are the following
1) Using an index. The number in the brackets indicates the index of the position you want to get
var position = Positions[4];
2) Using a label. When creating positions you can assign a label and then find them using the following function
var position = Positions.Find(label);
3) Using a label on multiple positions. If you use the same label on may positions, you can get them as follows
var positions = Positions.FindAll(label);
Let me know if this is what you are looking for.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
10 Oct 2017, 17:19
Hi irmscher9,
Try the following
int periords = 0; var rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, 14); for (int i = rsi.Result.Count - 1; i >= 0; i--) { if (rsi.Result[i] < 30) { Print("RSI was under 30 " + periords + " perions ago"); break; } else periords++; }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
10 Oct 2017, 11:53
Hi paul_jen345,
Thanks for reporting this issue to us. This a known behavior of cAlgo and the product team is looking into improving it.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
10 Oct 2017, 11:51
Dear Максим_Коваленко,
Custom indicators are not availabe on mobile apps.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
10 Oct 2017, 11:43
Hi pipsiper123,
The following code should do the work for you
var volume = Math.Ceiling((Symbol.QuantityToVolume(130.64) / (double)Symbol.VolumeStep)) * Symbol.VolumeStep;
Use Math.Ceiling or Math.Floor based on how you would like to round your volume.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
10 Oct 2017, 11:27
Hi hungtonydang,
If we suppose that you need the close price of a candle at 11:30 UTC (two hours before NY open time), the example below shows how to get the Close price of yesterday's candle at that time.
MarketSeries.Close[MarketSeries.OpenTime.GetIndexByExactTime(new DateTime(2017, 10, 9, 11, 30, 0).AddHours(TimeZone.BaseUtcOffset.Hours))]
Let me know if this is what you are looking for.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
10 Oct 2017, 10:26
Hi hungtonydang,
Indeed in case you need to find many positions with the same label you need to use FindAll(label). If you want to get all the positions opened by a specific instance of a cBot then you need to label them all with the same label and use FindAll() function to get them. Let me know if this helps.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
10 Oct 2017, 10:18
Hi zabarmel,
Thanks for posting in our forum. Can you please elaborate a bit more on the problem you are facing? In which chart mode are you in? Where do you want to drag the charts? Do you try to detach and you drag them instead? If you provide us additional information, it will allow us to help you more easily. Maybe if you could also send us a short video (you can use TinyTake for that) it wild be even better.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
12 Oct 2017, 16:43
RE: RE:
davideng5555 said:
Hi David,
You cannot make the specific script a stand alone cBot. It needs to be a part of a Robot class. Maybe you could elaborate on what you want to achieve?
Best Regards,
Panagiotis
@PanagiotisCharalampous