Topics
Replies
Spotware
04 Aug 2014, 17:48
You need to make sure that you use class name instead of indicator name. For instance, you need to use "SampleSMA" instead of "Sample SMA" in example shown there: /api/guides/indicators#el7
@Spotware
Spotware
01 Aug 2014, 16:28
RE:
There's no extension for SharpDevelop. However you can write a library using SharpDevelop and reference your cBot/Indicator to this library.
RootFX said:
hi
this fast IDE C#
SharpDevelop 4.4
http://www.icsharpcode.net/opensource/sd/download/
how i can use this IDE withe calgo .?
@Spotware
Spotware
31 Jul 2014, 14:50
RE: RE:
Use MarketSeries. Method Last - Access a value in the dataseries certain bars ago.
var previouseDayHigh = MarketSeries.High.Last(1); var previouseDayLow = MarketSeries.Low.Last(1);
hiba7rain said:
:) any suggestions
hiba7rain said:
Hi All,
am looking for your support, how can i get the higher high and lower low price for previous day?
Thanks
@Spotware
Spotware
30 Jul 2014, 10:53
RE: RE: RE: RE: RE: RE: RE:
As far as we see from your screenshot in MT4 you have extra candle on weekend day. Trading session in cTrader is configured to end on Friday and to start on Monday.
You should clarify about trading session configuration with your broker.
TonyPro said:
yes, it is. and each tick price is same for mt4 and ctrader , but the daily bar isn't same.
@Spotware
Spotware
30 Jul 2014, 09:30
( Updated at: 21 Dec 2023, 09:20 )
RE: RE: RE: RE: RE:
Is it one broker for both platforms?
TonyPro said:
The problem is cTrader chart and MT4 chart aren't same for the same trading day. even though I have wrote the same strategy as MT4 using C#, it doesn't work because the difference of two charts. but I know that the datas are same for both of charts. Is there any way to fix it?
Spotware said:
Daily bars start at 17:00 EST and it's not up to cAlgo to change that time.
If you need daily bars to open at 00:00 than you need to specify TimeZone of your cBot.
using cAlgo.API; namespace cAlgo { [Robot(TimeZone = TimeZones.EEuropeStandardTime, AccessRights = AccessRights.None)] public class BarOpen : Robot { protected override void OnStart() { Print(MarketSeries.OpenTime.LastValue); } } }will give you: 21.07.2014 0:00:00
TonyPro said:
Can I set the daily bars start time to 00:00 EST? because my strategy is based on that time.
Spotware said:
Daily bars are aggregated by 17:00 EST which is equal to 21:00 UTC. That's why you see such results.
It is a standard for financial markets to calculate new financial day after closing of american market session.
TonyPro said:
I want to backtest daily data during 2013 ~2014, but the problem is after I point the cursor to one daily bar, the daily info at the bottom bar is wrong. Specifically, the open time start from 21:00, and the open price is 21:00 hour open price, instead of daily open price. but the chart I'm using is daily chart, is this a bug of cTrader?
@Spotware
Spotware
29 Jul 2014, 17:53
RE:
You can debug your code using Visual Studio. It will help you to get full details about your exception.
apresau said:
Hi,
I'm having trouble with a crashing cBot.
The log message reads -
Crashed in OnTick with NullReferenceException: Object reference not set to an instance of an object.
@Spotware
Spotware
25 Jul 2014, 14:38
RE:
DateTime.Today returns System current time. You need Server.Time
flannery said:
Hey,
So I have been working on a bot where I need to get the price on the forex cross at specific times. This is not a problem when working with realtime. A snippet of what I have used for that part:
string day_0 = DateTime.Today.AddDays(0).ToString("dd/MM/yyyy"); .. cAlgo.API.Internals.MarketSeries barSeries = MarketData.GetSeries(TimeFrame.Minute15); .. barSer_08 = barSeries.OpenTime.GetIndexByExactTime(DateTime.Parse(day_0 + " 8:00AM")); double History_Price_08 = MarketSeries.Open[barSer_08];Now this will give me the open price of the bar at the exact time: today (bot is running after the time that day) at 8 AM.
However, when I try to use the same bot for historical testing it will not get the price of the "day today" for each day in the historical test.
Is it possible to do this with the historical tester?
@Spotware
Spotware
22 Jul 2014, 11:03
RE:
Hi clydeboo.
You have to pass data series of indicator: slowMa.Result
protected override void OnStart() { slowMa = Indicators.MovingAverage(OpenSourceSeries, SlowPeriods, MAType); fastMa = Indicators.MovingAverage(OpenSourceSeries, FastPeriods, MAType); vidya = Indicators.Vidya(slowMa.Result, vidPeriod, vidSigma); }
clydeboo said:
Just want to start off by saying that cAlgo rocks! Hats off to all the developers. cAlgo is a traders wet dream. Unfortunately this is a point of frustration with me because I'm not up to speed with cBot construction and the unbelievable potential continues to stare me in the face.
I've developed a bot that I'm incredible happy with but it needs refinement I want to develop more error management to minimize poor entry and or correct direction. This process has led me to using nested indicators. I want to create a VIDYA data series that uses a Welles Wilder Smoothing data series as its data source. I see how it is done when building an indicator but not how to do it with a bot.
I'm sure the process is simple...I just need a little nudge in the right direction.
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 swtBot : Robot { [Parameter("Wilder Smoothing")] public MovingAverageType MAType { get; set; } [Parameter("Wild Data")] public DataSeries OpenSourceSeries { get; set; } [Parameter("Wild Slow Periods", DefaultValue = 30)] public int SlowPeriods { get; set; } [Parameter("Wild Fast Periods", DefaultValue = 20)] public int FastPeriods { get; set; } [Parameter("VIDYA Period", DefaultValue = 30)] public int vidPeriod { get; set; } [Parameter("VIDYA Sigma", DefaultValue = 0.65, MinValue = 0.1, MaxValue = 0.95)] public double vidSigma { get; set; } //private IndicatorDataSeries wilderDataSeries; private Vidya vidya; private MovingAverage openMa; private const string label = "booger"; protected override void OnStart() { slowMa = Indicators.MovingAverage(OpenSourceSeries, SlowPeriods, MAType); fastMa = Indicators.MovingAverage(OpenSourceSeries, FastPeriods, MAType); vidya = Indicators.Vidya(slowMa, vidPeriod, vidSigma); }
@Spotware
Spotware
21 Jul 2014, 18:11
RE: RE: RE:
Daily bars start at 17:00 EST and it's not up to cAlgo to change that time.
If you need daily bars to open at 00:00 than you need to specify TimeZone of your cBot.
using cAlgo.API; namespace cAlgo { [Robot(TimeZone = TimeZones.EEuropeStandardTime, AccessRights = AccessRights.None)] public class BarOpen : Robot { protected override void OnStart() { Print(MarketSeries.OpenTime.LastValue); } } }
will give you: 21.07.2014 0:00:00
TonyPro said:
Can I set the daily bars start time to 00:00 EST? because my strategy is based on that time.
Spotware said:
Daily bars are aggregated by 17:00 EST which is equal to 21:00 UTC. That's why you see such results.
It is a standard for financial markets to calculate new financial day after closing of american market session.
TonyPro said:
I want to backtest daily data during 2013 ~2014, but the problem is after I point the cursor to one daily bar, the daily info at the bottom bar is wrong. Specifically, the open time start from 21:00, and the open price is 21:00 hour open price, instead of daily open price. but the chart I'm using is daily chart, is this a bug of cTrader?
@Spotware
Spotware
21 Jul 2014, 14:58
RE:
Daily bars are aggregated by 17:00 EST which is equal to 21:00 UTC. That's why you see such results.
It is a standard for financial markets to calculate new financial day after closing of american market session.
TonyPro said:
I want to backtest daily data during 2013 ~2014, but the problem is after I point the cursor to one daily bar, the daily info at the bottom bar is wrong. Specifically, the open time start from 21:00, and the open price is 21:00 hour open price, instead of daily open price. but the chart I'm using is daily chart, is this a bug of cTrader?
@Spotware
Spotware
21 Jul 2014, 14:08
RE: RE: RE: RE:
is there any link or source might be useful to understand the codes and variables to be used if I would like to work on a robot using bars
OnBar - you can use it to execute you logic on each incoming Bar.
but with a major problem if I operate the robot it close all other opened positions with
It closes all positions because you iterate through all positions and call ClosePosition. It's up to you what positions should be closed.
hiba7rain said:
Thanks its working perfectly but with a major problem if I operate the robot it close all other opened positions with
if (ema1.Result.LastValue > Symbol.Ask) { foreach (var position in Positions) { ClosePosition(position);Any suggestions??
Regards,
Spotware said:
one is via stop loss parameter
You set the stoploss on executing market order. So no extra actions needed there.
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
other by value of ask price against EMA is it possible to do so? if yes how to?
protected override void OnTick() { CheckForEMA(); } private void CheckForEMA() { if (ema1.Result.LastValue > Symbol.Ask) { foreach (var position in Positions) { ClosePosition(position); } } }
other by value of ask price against EMA
is it possible to do so? if yes how to?
hiba7rain said:
Spotware said:
TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.
Hi Spotware,
what could be wrong with the following , my intention to create two different methods to close position one is via stop loss parameter and other by value of ask price against EMA
is it possible to do so? if yes how to?
private void Open(TradeType tradType) { ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips); Print(LastResult.Position.TradeType); } private void Close() { foreach (var position in Positions) { ClosePosition(position); } if (ema1.Result.LastValue > Symbol.Ask) { Close(); } }
@Spotware
Spotware
21 Jul 2014, 10:08
RE: RE:
one is via stop loss parameter
You set the stoploss on executing market order. So no extra actions needed there.
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
other by value of ask price against EMA is it possible to do so? if yes how to?
protected override void OnTick() { CheckForEMA(); } private void CheckForEMA() { if (ema1.Result.LastValue > Symbol.Ask) { foreach (var position in Positions) { ClosePosition(position); } } }
other by value of ask price against EMA
is it possible to do so? if yes how to?
hiba7rain said:
Spotware said:
TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.
Hi Spotware,
what could be wrong with the following , my intention to create two different methods to close position one is via stop loss parameter and other by value of ask price against EMA
is it possible to do so? if yes how to?
private void Open(TradeType tradType) { ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips); Print(LastResult.Position.TradeType); } private void Close() { foreach (var position in Positions) { ClosePosition(position); } if (ema1.Result.LastValue > Symbol.Ask) { Close(); } }
@Spotware
Spotware
21 Jul 2014, 09:30
RE:
Can you answer to next questions
- Do you face such problem everytime?
- Do you run cbot while saving changes in VS?
- Do you use VM ? Is "Documents" a shared folder? Are you running your virtual machine on Mac?
jallopy said:
I also have this issue.
if I edit in calgo, and return to vstudio , vstudio states the source code has changed do you want to refresh. However edit in vstudio, nothing appears in calgo until the restart.
In the YouTube demo it seems to work.
thanks.
@Spotware
Spotware
18 Jul 2014, 10:04
( Updated at: 21 Dec 2023, 09:20 )
For the above example if OnTick handler takes 5 seconds to process 1 tick while several ticks come to the platform, next OnTick handler will be invoked for the latest unhandled tick. All previous ticks will be skipped.
You may also be interested in newly added RefreshData method. It explicitly updates MarketSeries, Positions, PendingOrders, etc.
@Spotware
Spotware
17 Jul 2014, 12:59
RE: RE:
1. when I login at home PC - all OK, but when I login at work - I see this error. I have unlimited internet at work.
It looks like antivirus or local network configuration does not work correctly with technology, we use to communicate with servers (web sockets).
Try to disable antivirus, if you have one.
You may use this website http://websocketstest.com to diagnose if web sockets work for you. Anyway, if it says, that web sockets work, your company firewall may have such rules, that only affect particular addresses. Talk to admins, try VPN (this might work).
There is nothing, we can do from our side to help you with your issue.
@Spotware
Spotware
17 Jul 2014, 12:19
Please help us to investigate issue by answering these questions
1. Did you manage to login successfully before? What changed since then (new laptop, provider, location, etc?)
2. Can you create and log in into demo account (no need for real credentials)? See tab "Demo account".
3. Try to login while in in chrome incognito mode (https://support.google.com/chrome/answer/95464?hl=en). Do you see same error message? Can you create demo account in incognito mode?
@Spotware
Spotware
05 Aug 2014, 10:58 ( Updated at: 23 Jan 2024, 13:16 )
[Abdallah_Hacid], thank you for the issue report. Code is updated.
@Spotware