lec0456's avatar
lec0456
lec0456's avatar

Info

Username:lec0456
Name:lec0456
Member since: 14 Nov 2012

About

None

Signature

None

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

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
EURUSD Index V2
  0
  5
  3366
free  25 Apr 2015
Determines the daily increase or decrease in the value of the Euro and Dollar.The actual and projected value of the pair is also plotted. This version of the EURUSD index allows for both daily and weekly yield indexes.  It gives you the option to weight the index based on volume and the option to use 4 or 8 pairs for calculation. Finally, it corrects a problem with pairs that don't start trading at the same time.
SMA Slope Indicator
  4
  0
  3113
free  17 Apr 2015
My slope indicator calculates the slope of a smoothed SMA.  You can enter the backstep, meaning the length of time you want to go back to measure the slope.  A slope limit allows you to judge when a threshold is reached for trading.  MA tolerance sets a value for the amount of change in the moving average needed to register a peak. Slope peak tolerance sets a minimum value to register a peak in the slope. The slope indicator registers peaks in the ma and slope.  It also gives a signal if the slope is flat for 12 periods.    
EurUSD Daily Index
  1
  5
  3584
free  06 Nov 2014
Determines the daily increase or decrease in the value of the Euro and Dollar.The actual and projected value of the pair is also plotted.
Real Dividers 2.0
  3
  0
  2907
free  29 Dec 2018
Knowing when the trading day begins and the trading week ends is very important to technical analysis. You can't just use your own time zone to determine it. It is the same for every trader all over the world.  In general it occurs at 12am EEST which is +2 for part of the yesr and +3 for part. Unfortunately the period separators that are included in cTrader will not mark the correct day end and week end positions nor will it give you signals to take action within your robots.  This indicator takes the guess work out of it, marks the real day end and week end positions and provides signals to take actions within robots.
Real Market Time
  3
  5
  5235
free  22 Apr 2013
A simple but useful indicator that places the time in London, New York, Sydney and Tokyo right on the chart.  The time will be in color if the session is active and you can select 24 or 12 hour format.  Unlike the Real Market Hours indicator, this indicator is based on your computer's local time, not the broker's server time so make sure its right.  
Real Market Hours
  12
  5
  4745
free  09 Sep 2013
Half the secret to being successful in the ForEx markets is timing.  I haven't seen a reliable market hours indicator posted here, so here is my verison.  Opening and closing times for the New York and London markets are based on 8 to 5 business hours.  Opening and closing times for Sydney and Japan are based on 9 to 5 business hours.  Some people use 6pm close time for Tokyo and some use a 4pm close time for Sydney.  However, did you know that ForEx trading hours are not based on corresponding stock markets close times?  They are based on investment banking business hours.  You can set the hours as you like within the indicator.  Many beginers think once you convert the business hours to local time that you will have the market hours all figured out, but its not that simple.  Did you know that Daylight savings starts on different days in London and New York.  So there is a period in March where  opening time in New York is at 12pm instead of 1pm.  Did you know Daylight savings in Austrailia is reverse that of New York so that opening times shift 2 hours instead of one between the winter and summer months, leaving a 2 hour gap between the New York close and the Sydney open?  Do you know which timezone your broker is using and how it affects the conversion?  Well all that is taken care of with my handy dandy market hours indicator! WooHoo! The markets are color coded and I assigned the market hour value to the result so you could better visually see as markets are coming to a close and execute trades based on specific hours.  Make sure you comment out the LocalTime zone which does not apply to you.  cTrader brokers seem to be using either Cyprus time or UTC Local Time Zones.  Hope it helps!
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
Candle Countdown Form
  2
  0
  1221
free  01 Mar 2019
This is a simple little feature I was interested in for a while but never found. It creates a windows form that displays a countdown of the current bar in big letters. It also beeps at the begining/end of a bar. I don't know, I tried using third party timers but they have to be manually synced with the Servers time.  This updates every second from the server so its never off.    Using Visual Studio would be better but I got it to work without it. I just updated it so you can set the form tto stay on top. You must add the System.Threading, System.Drawing and System.Windows.Forms libraries. You can use the algo as is or recreate the form in visual studio. You can download a free community version from Mircosoft. From cTrader's cBot menu, select "edit in visual studio".  Then add the 2 classes and paste the code into the files that visual studio creates. Build and your all set.