
lec0456

Info
Username: | lec0456 |
Name: | lec0456 |
Member since: | 14 Nov 2012 |
About
Signature
Last Algorithm Comments
@Candle Countdown Form: 01 Mar 2019, 10:35
I got the cBot to build with the source code. It seems like that function will not work if you have other visual studio objects in separate files. So, i put them all into one file and it worked.
@Real Dividers 2.0: 29 Dec 2018, 07:24
Recently udated to indicate when the trading day and week begins according to how cTrader agregates daily and weekly data. Finally got it right.
@Real Dividers: 30 Apr 2018, 03:46
Recently updated to include the Time zone offset which changes depending on the part of the year you are trading in.
@SMA Slope Indicator: 19 Apr 2015, 19:27
Sure, its just a sma wit an sma applied to it. It removes some of the choppyness between close periods. using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = true, ScalePrecision = 7,TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class mySmoothSMA : Indicator { [Parameter()] public DataSeries Source { get; set; } [Parameter(DefaultValue = 24)] public int paramPeriods { get; set; } [Parameter(DefaultValue = 3)] public int paramSmoothing { get; set; } [Output("SMA", Color = Colors.Red)] public IndicatorDataSeries Result { get; set; } private SimpleMovingAverage sma; private SimpleMovingAverage smoothsma; protected override void Initialize() {sma = Indicators.SimpleMovingAverage(Source, paramPeriods); smoothsma = Indicators.SimpleMovingAverage(sma.Result, paramSmoothing);} public override void Calculate(int index){ Result[index] = smoothsma.Result[index];} } }
@Real Market Hours: 17 Apr 2015, 09:15
if you are live it will give you a different value depending on when you run it. but it works for me.just the way you mention. As far as daylight saving, the system time functions take care of that when you convert. so, all is good.
@Real Market Hours: 17 Apr 2015, 09:15
if you are live it will give you a different value depending on when you run it. but it works for me.just the way you mention. As far as daylight saving, the system time functions take care of that when you convert. so, all is good.
@Real Market Hours: 09 Sep 2013, 19:52
So, just uploaded a big update to this indicator related to all the recent platform changes in handling the Time. So now the robot uses the timezone set by the new timezone attribute of the indicator. Before, there would have been issues if you set the indicator timezone to something different from the broker timezone, but now they are one and the same. Good Luck!
@Real Time Fibonacci Indicators: 04 May 2013, 18:08
This looks interesting. So, how do you trade with it?
@Real Market Hours: 18 Apr 2013, 01:54
Robo Forex and Fibo Group are also using Cyprus time. Actually, I think its best because it divides the day properly. Once New York closes on a particular day, the Australian Session begins on the following day. For example, if the NY session closes on the 15th at 4:59pm EST at 5pm EST the Australian Session begins and it is the 16th in Australia. Cyprus time is 12am. During the summer months when there is a gap between the NY and Australian Sessions, Cyprus time still falls in between, nicely dividing the trading day data. I guess that's why Cyprus is the center of the Forex Universe:)
@Real Market Hours: 15 Apr 2013, 06:44
I added the following lines: TimeZoneInfo LocalTimeZone = TimeZoneInfo.FindSystemTimeZoneById("UTC"); //GMT Time w/ no daylight savings For Divisa Capitol and IC Markets //Print("Local Time Zone Name:{0} Offset:{1} DST:{2} ",LocalTimeZone.DisplayName,LocalTimeZone.BaseUtcOffset,LocalTimeZone.SupportsDaylightSavingTime); [Levels(8,9,10,11,12,13,14,15,16)]
Last Forum Posts
@LoadMoreHistory doesn't work when indicator used in Bot: 06 Apr 2021, 06:58
Hi,
I have a multi-currency indicator that works fine as an indicator. It auto-loads history if there is not enough when you get the symbol bar data on initializing the indicator. If you scroll back the On Calculate will load more bar data as well. See the code below. However, when I place the indicator into a Bot, loadmorehistory does not return any bars. It also seems the backtesting engine starts the indicators at an earlier date than the date range you select through the interface. is this an error by design or what?
public override void Calculate(int index)
{
try
{
int p0 = -1;
if (index < 0 || TimeFrame >= TimeFrame.Daily) return;
//Load more currency bars when the instance symbol bars start before the other symbols
for (int i = 0; i < prdMS.Length; i++)
{
while (Bars.OpenTimes[index] < prdMS[i].OpenTimes[0])
{
var loadedCount = prdMS[i].LoadMoreHistory();
SeriesStartDates[i] = prdMS[i].OpenTimes[0];
if (loadedCount==0)
{
Print (prdMS[i].SymbolName+" failed to load more history.");
break;
}
else
{
Print("{0} Loaded {1} bars on {2} Timeframe. {3} total bars.", prdMS[i].SymbolName, loadedCount, TimeFrame, prdMS[i].Count);
}
}
}
@Bot and indicators not showing up as user code in VS2019: 05 Apr 2021, 19:05
I am having trouble using the VS debugger. After I attach to a running Bot which is backtesting, the modules window shows some referenced indicators as user code but the Bot and other indicators are not. I believe they all should be recognized as user code. Whats going on? The first yes/no column is whether the code is optimized and the second is whether its user code. The debugger options is set to debug "Just my Code" so this is not right.
@Debugging in Visual Studio 2015: 05 Apr 2021, 09:37
lec0456 said:
lec0456 said:
I am using VS 2019 Enterprise and I get the message: "No symbols have been loaded for this document", for each break point I put in my bot. I followed all the instructions in the cTrader Guide. So, whats the problem?
ok, I fixed it. I uninstalled cTrader completely by removing the directories under the AppData\Roaming folder, but i don't think that was the key. I had previous versions of VS on my system from 2010/12/15 and 17. I used the extension manager to install the cBot extension in VS2019. So, I uninstalled the extension. I did that for every version and edition. Like I had 2019 Community and Enterprise and 2017 Community and enterprise. So, once I had the extensions all uninstalled. I went to cTrader and tried clicking edit in VS. It did nothing. Didn't open VS or launch the extension installer. So, from another post in the forum,I found a registry key in
HKCU\Software\\Microsoft\VisualStudio\11\ExtensionManager\EnabledExtensions\2c72cc50-6c69-4b16-b1f4-ab470673f284,1.6
that was preventing the installer from launching. Once I removed the key, the installer worked from cTrader. Once, I had the extension reinstalled by cTrader, rather than from the VS extension manager, and I built the solution in VS, the debugger in VS 2019 worked. All the symbols loaded properly and the breakpoints are working.
The post from the other forum found the problem in a different registry key.
HKCU\Software\\Microsoft\VisualStudio\10\ExtensionManager\EnabledExtensions\2c72cc50-6c69-4b16-b1f4-ab470673f284,1.4
Must be leftover keys from previous installations. I don't how or why the old extensions that were installed affected a new install of VS2019 with the new cBot extension but apparently it had a problem. I don't think the reinstall of cTrader was necessary after al that but I was eliminating variables. Hope that helps someone.
OK, scratch that. While the above will help you if you can't trigger the VS installer from cTrader. My problem with breakpoints not working and symbols not loading persisted. The issue seems to be that VS2019 only loads the symbols if the Bot is running when you attach the process. So, I have to start backtesting and THEN attach to process for the symbols to load and the breakpoints to work. This is NOT the way the cTrader Help Center describes the process. It specifically says to attach the process before running the bot. But that won't work for me. So, either I am doing something wrong or the cTrader documentation is wrong. Or maybe it needs to be updated for changes in VS2019. I would like a response from cTrader about this issue.
@Re-integration with Visual Studio: 05 Apr 2021, 06:31
So, I had the same problem. When i went to click edit in VS cTrader did nothing. I was troubleshooting a problem with debugging in 2019. I uninstalled all the extension using the extension manager in VS. Note: I had community and enterprise versions for 2019 and 2017. i figured it would trigger the extension installer when I clicked edit in VS using cTrader. It did not. Turns out using the info above, I had a registry entry under \VisualStudio\11\ExtensionManager\EnabledExtensions\<same number as above>. Once I deleted it, ctrader launched the installer.
@Debugging in Visual Studio 2015: 05 Apr 2021, 05:19
lec0456 said:
I am using VS 2019 Enterprise and I get the message: "No symbols have been loaded for this document", for each break point I put in my bot. I followed all the instructions in the cTrader Guide. So, whats the problem?
ok, I fixed it. I uninstalled cTrader completely by removing the directories under the AppData\Roaming folder, but i don't think that was the key. I had previous versions of VS on my system from 2010/12/15 and 17. I used the extension manager to install the cBot extension in VS2019. So, I uninstalled the extension. I did that for every version and edition. Like I had 2019 Community and Enterprise and 2017 Community and enterprise. So, once I had the extensions all uninstalled. I went to cTrader and tried clicking edit in VS. It did nothing. Didn't open VS or launch the extension installer. So, from another post in the forum,I found a registry key in
HKCU\Software\\Microsoft\VisualStudio\11\ExtensionManager\EnabledExtensions\2c72cc50-6c69-4b16-b1f4-ab470673f284,1.6
that was preventing the installer from launching. Once I removed the key, the installer worked from cTrader. Once, I had the extension reinstalled by cTrader, rather than from the VS extension manager, and I built the solution in VS, the debugger in VS 2019 worked. All the symbols loaded properly and the breakpoints are working.
The post from the other forum found the problem in a different registry key.
HKCU\Software\\Microsoft\VisualStudio\10\ExtensionManager\EnabledExtensions\2c72cc50-6c69-4b16-b1f4-ab470673f284,1.4
Must be leftover keys from previous installations. I don't how or why the old extensions that were installed affected a new install of VS2019 with the new cBot extension but apparently it had a problem. I don't think the reinstall of cTrader was necessary after al that but I was eliminating variables. Hope that helps someone.
@Debugging in Visual Studio 2015: 05 Apr 2021, 04:56
I am using VS 2019 Enterprise and I get the message: "No symbols have been loaded for this document", for each break point I put in my bot. I followed all the instructions in the cTrader Guide. So, whats the problem?
@Mouse over text for the IndicatorArea: 21 Mar 2021, 17:45
lec0456 said:
How can I display some custom text when the mouse rolls over an IndicatorDataSeries Output on a indicator area? In other words, the IsOverlay is set to false for the indicator.
It does not appear that the Output Series' are considered objects on the chart. because if I place: Print("objects:"+obj.ChartArea.Objects.Count); in the MouseMove event it returns zero.
@Mouse over text for the IndicatorArea: 21 Mar 2021, 17:37
Thanks, but what i am really looking for it that the tooltip appears when the mouse rolls over the Output line. So, if Main is the moving average, when you rollover main it displays the text at the point you rolled over the line.
@Mouse over text for the IndicatorArea: 21 Mar 2021, 10:00
How can I display some custom text when the mouse rolls over an IndicatorDataSeries Output on a indicator area? In other words, the IsOverlay is set to false for the indicator.
@Programmatically change visibility of output: 13 Nov 2020, 03:51
Ah, ok, didn't think of that. But wasn't sure if I needed a workaround of if it could be done by setting an attribute