
Topics
Replies
PanagiotisCharalampous
24 Sep 2020, 16:39
Hi cosacdaher,
Please help me understand why it didn't work
I cannot help you with this since there is not evidence it did not work. If you do not remember the Equity Stop Loss level then how do you know it did not work?
why was I allowed to copy an strategy with $100 if that was not enough margin to operate within the strategy
The minimum investment amount is set by the strategy provider, not by us. You were allowed to follow because this is what the strategy provider set as minimum
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
24 Sep 2020, 16:06
Hi arthur.albert990,
Hello PanagiotisCharalampous, i've tried to add an output to the code and the "Result" on Calculate() but i'm unable to obtain the result from macd, platform tells me that the ZeroLagMACD doesn't has a definition for Result.
If this is the indicator you use, then it doesn't :)
Here are your options
[Output("Histogram", Color = Colors.Turquoise, PlotType = PlotType.Histogram)]
public IndicatorDataSeries Histogram { get; set; }
[Output("MACD", Color = Colors.Blue)]
public IndicatorDataSeries MACD { get; set; }
[Output("Signal", Color = Colors.Red, LineStyle = LineStyle.Lines)]
public IndicatorDataSeries Signal { get; set; }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
24 Sep 2020, 10:27
Hi Sam,
Here you go
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 = 0.0)]
public double Parameter { get; set; }
RelativeStrengthIndex _rsiDaily;
RelativeStrengthIndex _rsiHourly;
protected override void OnStart()
{
var dailyBars = MarketData.GetBars(TimeFrame.Daily);
var hourlyBars = MarketData.GetBars(TimeFrame.Hour);
_rsiDaily = Indicators.RelativeStrengthIndex(dailyBars.ClosePrices, 14);
_rsiHourly = Indicators.RelativeStrengthIndex(hourlyBars.ClosePrices, 14);
}
protected override void OnBar()
{
if (_rsiDaily.Result.Last(1) > 60 && _rsiHourly.Result.Last(1) > 60)
{
ExecuteMarketOrder(TradeType.Buy, Symbol.Name, 1000);
}
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
24 Sep 2020, 07:56
Hi sam,
There are a lot of mistakes in your code. What is the actual information you are missing?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
24 Sep 2020, 07:51
Hi arthur.albert990,
It does not display anything because you do not have any output. Read here how to create a custom indicator.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 16:03
Hi Sam,
Here is the correct condition
if (Positions.Count == 0)
{
// Do something
}
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 14:19
Hi ctid1074959,
You can post it here. If you don't want to disclose the code, you can send it to community@spotware.com
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 14:13
Hi Mark,
Is it possible in cTrader Automate to programmatically populate a data structure with the values that would make up a 1 hour candle constructed from mid prices, i.e. open mid, high mid, low mid and close mid?
Yes this is possible
Is GetTicks() the way to do this, i.e. get all the ticks from e.g. 10:00 am and 0 seconds to 10:59 and 59 seconds, then convert the ticks to mid price using the ask and the bid and then select the open, high, low and close from the mid price ticks to give me 4 values representing a 1 hour candle constructed from mid prices?
Yes you should use GetTicks() for this.
Also is GetTicks() able to get every tick in a 1 hour time frame or does it miss ticks, for example in MT4 the on-tick event is triggered by a tick, but if your algo is still processing this tick when the next tick arrives it will miss this next tick.
This is how it works in cTrader as well but this should not affect historical data. Ticks are stored on the server even if your client does not process them.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 13:58
Hi ctid1074959,
as mentioned above, I have a variable called :"absolutehigh" for highest profit point for time period... the "absoluteHIgh" for the shorter time period is higher (25k) vs the onger time period of (17k)... this should NOT be
No, you did not provide this information in the original post. To help you further with this, you need to provide us with the complete cBot code and steps to reproduce this behavior e.g. cBot parameters or any other information we need to know.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 09:24
Hi cumpac21,
Trades are not copied to your main account but in your subaccount, which is accessible only through the cTrader Copy section on cTrader Web. You should go through the documentation before using the service.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 09:07
Hi cumpac21,
Please provide more information about the problem. What is the balance of your subaccount? What is the leverage? Which trades have not been copied?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 08:27
Hi Tan,
It is not possible to access cTrader Web from Android and iOS devices.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 08:26
Hi Sam,
You can check if Positions.Count == 0 before placing a trade.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 08:24
Hi there,
Why do you expect to see the same results on different dates?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Sep 2020, 08:22
Hi Fxpool,
This section is only for suggestions. Please post your issue in cTrader Copy section. This post will be deleted soon.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2020, 08:43
Hi ctid956028,
Yes but it is hosted in a third party application which we do not control. So we need the information requested above. If you cannot provide it, then the developer can do it.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2020, 08:13
Hi lazar.florinmihai,
Thanks for posting your issue but I am afraid I did not understand what the problem is. If you could describe it in another way or maybe record a video, it would be helpful.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2020, 08:09
Hi Mars24,
Please use the Suggestions section for suggestions.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2020, 08:04
( Updated at: 21 Dec 2023, 09:22 )
Hi duketv,
If you check your log you will see an exception.
This happens because you have not initialized your Bollinger Bands indicator anywhere. Add this in OnStart()
BollingerBands = Indicators.BollingerBands(Bars.ClosePrices, BbPeriods, BbStdDev, BbMaType);
On top of that, you are trying to modify a position that does not exist
protected override void OnBar()
{
var bbTop = BollingerBands.Top.LastValue;
var bbMain = BollingerBands.Main.LastValue;
var bbBottom = BollingerBands.Bottom.LastValue;
if (_sma1.Result.LastValue < Symbol.Bid & Macd.MACD.Last(0) > Macd.Signal.Last(0) & Macd.MACD.Last(0) < 0)
ExecuteMarketOrder(TradeType.Buy, this.SymbolName, Volume, InstanceName, null, null);
Positions[0].ModifyStopLossPrice(bbBottom);
if (_sma1.Result.LastValue > Symbol.Bid & Macd.MACD.Last(0) < Macd.Signal.Last(0) & Macd.MACD.Last(0) > 0)
ExecuteMarketOrder(TradeType.Sell, this.SymbolName, Volume, InstanceName, null, null);
Positions[0].ModifyStopLossPrice(bbTop);
}
Try this instead
protected override void OnBar()
{
var bbTop = BollingerBands.Top.LastValue;
var bbMain = BollingerBands.Main.LastValue;
var bbBottom = BollingerBands.Bottom.LastValue;
if (_sma1.Result.LastValue < Symbol.Bid & Macd.MACD.Last(0) > Macd.Signal.Last(0) & Macd.MACD.Last(0) < 0)
{
var position = ExecuteMarketOrder(TradeType.Buy, this.SymbolName, Volume, InstanceName, null, null).Position;
position.ModifyStopLossPrice(bbBottom);
}
if (_sma1.Result.LastValue > Symbol.Bid & Macd.MACD.Last(0) < Macd.Signal.Last(0) & Macd.MACD.Last(0) > 0)
{
var position = ExecuteMarketOrder(TradeType.Sell, this.SymbolName, Volume, InstanceName, null, null).Position;
position.ModifyStopLossPrice(bbTop);
}
}
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
24 Sep 2020, 16:49
Hi maciel.rafael1,
cTrader does not stop cBots. cBots are either stopped manually/automatically by the trader or due to some exception. Did you check your logs? Are there any messages there indicating why the cBot has stopped?
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous