
Topics
Replies
PanagiotisCharalampous
30 Jan 2018, 12:47
Hi Drummond,
Try the code below
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 FIBBOT : Robot { [Parameter("TP Pips", DefaultValue = 10, MinValue = 1)] public int takeProfitPips { get; set; } [Parameter("StopLossPips", DefaultValue = 1, MinValue = 1)] public int stopLossPips { get; set; } [Parameter("Periods", DefaultValue = 20)] public int period { get; set; } public DataSeries series { get; set; } string label = "Fib Bot"; protected override void OnStart() { } private int HighestBar(DataSeries series, int period) { for (int i = 0; i <= period; i++) { if (series[series.Count - 1 - i] == series.Maximum(period)) { return i; } } return -1; } private int LowestBar(DataSeries series, int period) { for (int i = 0; i <= period; i++) { if (series[series.Count - 1 - i] == series.Minimum(period)) { return i; } } return -1; } protected override void OnTick() { int x = HighestBar(MarketSeries.High, period); Print(" HighestBar = " + x); int y = LowestBar(MarketSeries.Low, period); Print(" LowestBar = " + y); if (x > y) { ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, label, stopLossPips, takeProfitPips); } } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
30 Jan 2018, 11:13
Hi Drummond,
The problem is that you are not initializing the series anywhere. Which series would you like to use?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
30 Jan 2018, 10:48
Hi Drummond,
Please post the complete cBot code and we will let you know why you receive the error.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 17:56
Hi,
Currently there is no way to do this but this feature will be available in a future release of cTrader.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 17:27
Hi mishavas15@gmail.com,
From what I can see you are in the backtesting section. Lines are not drawn in the backtesting chart. Try to run the cBot on an actual chart.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 15:44
Dear Trader,
Thanks for posting in our forum. You can use the DrawVerticalLine function.
Let me know if this information is helpful.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 15:41
Hi again,
For example the price already hit the trigger for 20 pips, and an addition of 10 pips, so the SL move from breakeven point plus additional 10 pips, the question is is it still possible to use the breakeven function after that?
Yes you can, however you need to do this manually after the first break even is triggered
As for the advance protection take profit, my question, is it possible to use the advance protection even though my laptop/computer is offline, is the advance protection take profit server side, as well for the breakeven function.
No, the advanced protection is a client side function. Read the textbox in the Advanced Protection window.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 14:37
Hi,
In this case you should use something like the below
using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using System; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class ingolf : Robot { const string label = ""; private double stopLossPrice; protected override void OnStart() { } protected override void OnBar() { var stopLossPrice = MarketSeries.Low.LastValue - Symbol.PipSize * 5; var pips = Math.Round((Symbol.Ask - stopLossPrice) / Symbol.PipSize); ExecuteMarketOrder(TradeType.Buy, Symbol, 1000, label, pips, 20); } protected override void OnStop() { // Put your deinitialization logic here } } }
Let me know if this helps you,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 12:45
Hi Daniel,
Currently cAlgo does not offer any of the two functionalities. However, they are both in our backlog therefore you should expect them in a future release of cAlgo.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 12:38
Hi Daniel,
Thanks for posting in our forum. Can you please share your code so that we can check what is wrong?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 12:35
Hi Alexander,
The problem lies in the following line of code
var distance = _tradeType != TradeType.Sell ? Symbol.Bid - entryPrice : entryPrice - Symbol.Ask;
The _tradeType is always Sell even if the open position is Buy. Can you explain to us what are you trying to achieve here?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 11:46
Hi dordkash@gmail.com,
Can you share your code with us to check what could go wrong?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
29 Jan 2018, 11:11
Hi DelTrader,
This is not possible using cAlgo.API. You can do that using Connect API however this is not so simple therefore I cannot provide you with an example code. You will need advanced coding skills to achieve that.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Jan 2018, 15:23
Hi hadikhalil86@gmail.com,
This needs to be troubleshooted by our support team. Please send an email to feedback@spotware.com with the following details.
- cTID
- Time of events that you would expect to get an email but you did not receive one.
After that our engineers with investigate if the emails are sent from our side.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Jan 2018, 11:54
Dear Trader,
Thanks for posting in our forum. This value is used to add pips to the breakeven price. If, for example your break even price is 1.24566 and you add 1 pip to to the break even price, then when the trigger is fired it will move the stop loss to 1.24566 + 1 pip = 1.24576.
Let me know if my explanation is clear enough.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Jan 2018, 11:39
Hi tradingu,
cTrader Copy can cater both types of clients. Are there any features you believe professional money managers should have?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Jan 2018, 10:13
Hi DelTrader,
See below a correct way to write this function
protected override void OnTick() { var Symbol1MarketData = MarketData.GetSymbol("EURUSD"); var Symbol2MarketData = MarketData.GetSymbol("USDJPY"); var Symbol3MarketData = MarketData.GetSymbol("EURGBP"); var Symbol1Low = MarketSeries.Low.LastValue; var Symbol2Low = MarketSeries.Low.LastValue; var Symbol3Low = MarketSeries.Low.LastValue; var Symbol1Bid = Symbol1MarketData.Bid; var Symbol2Bid = Symbol2MarketData.Bid; var Symbol3Bid = Symbol3MarketData.Bid; var Symbol1Ask = Symbol1MarketData.Ask; var Symbol2Ask = Symbol2MarketData.Ask; var Symbol3Ask = Symbol3MarketData.Ask; var Symbol1Result = Symbol1Bid - Symbol1Ask; var Symbol2Result = Symbol2Bid - Symbol2Ask; var Symbol3Result = Symbol3Bid - Symbol3Ask; if (Symbol1Result > Symbol2Result && Symbol2Result > Symbol3Result) { ExecuteMarketOrder(TradeType.Buy, Symbol, 1000); } }
Let me know if this helps,
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Jan 2018, 10:05
Hi tmc,
cAlgo issue is currently investigating this issue. We still don't know when this is going to be resolved.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Jan 2018, 15:50
Hi Piotr,
I am happy to hear that you have resolved your issue and thanks for the tip :) It will be useful in case other cTrader users encounter the same issue .
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
30 Jan 2018, 15:55
Hi irmscher9,
Can you please post the image in the forum? I do not have access to it anymore.
Best Regards,
Panagiotis
@PanagiotisCharalampous