bart1's avatar
Bart A
Bart A's avatar

Info

Username:bart1
Name:Bart A
Member since: 03 Aug 2017

About

None

Signature

None

Last Algorithm Comments

@TimeframeSync:  10 Aug 2021, 19:10


Test

@SwitchSymbol:  03 Feb 2021, 18:54


New indicator with symbols and periods https://ctrader.com/algos/indicators/show/2562

@SwitchSymbol:  25 Jun 2020, 09:40


It just needs on chart location changing option. Added

@Auto Drawings:  31 Oct 2019, 09:24


Probably your broker has cTrader version 3.5. This indicator use custom UI from  the new version 3.6. You can try it with Spotware cTrader https://spotware.com/beta/

Last Forum Posts

@[Instruction] Telegram notifications:  26 May 2020, 16:08


Here is a simple instruction to add Telegram notifications into your cBot or indicator.

First you need to create your own bot by chatting with BotFather in Telegram

Send /newbot and it will ask desired display name and user name for your new Telegram bot.

From the final message you need Token. Also you need to get chat ID for your new bot to send messages to you.

Go to your bot by clicking link in the final message and send some text.

To get chat ID you need to request latest updates from your bot by entering following URL in your browser:  https://api.telegram.org/bot<TOKEN>/getUpdates
replace <TOKEN> placeholder with your bot token

In response you will get text where you can find chat id
Example: ..."chat":{"id":123,...

Now you have 2 required parameters to send Telegram notifications and you can create cBot or indicator to test it. Telegram messages can be send using simple HTTP request. Here is a helper class that will do it for you.

public class TelegramBot
{
    public string Token { get; private set; }
    public int ChatId { get; private set; }

    public TelegramBot(string token, int chatId)
    {
        UseTls12();
        Token = token;
        ChatId = chatId;
    }

    public bool Send(string message)
    {
        var url = string.Format("https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}", Token, ChatId, message);
        var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
        var response = (System.Net.HttpWebResponse)request.GetResponse();
        return response.StatusCode == System.Net.HttpStatusCode.OK;
    }

    public bool Send(string message, params object[] args)
    {
        var formattedMessage = string.Format(message, args);
        return Send(formattedMessage);
    }

    private void UseTls12()
    {
        // Required for SSL/TLS connection with Telegram
        // Will work only on .Net 4.5 or higher
        // Using number to avoid compilation error
        System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3072;
    }
}

After adding this class to your cBot or indicator you can send notifications like this:
replace <TOKEN> and <CHAT_ID> with yours

private TelegramBot TelegramBot;

protected override void OnStart()
{
    TelegramBot = new TelegramBot("<TOKEN>", <CHAT_ID>);
    TelegramBot.Send("Started {0} {1}", SymbolName, TimeFrame);
}

NOTE: cBot and indicators need extended permission. You need to use Internet or FullAccess permissions:

[Robot(AccessRights = AccessRights.Internet)]
public class NewcBot : Robot

@Don't split lines so much when reformatting source during build:  23 Oct 2019, 09:15


You can disable auto formatting in code editor using this setting:

@Introducing Chart Controls in Automate API:  26 Jul 2019, 16:38


I don't know what for, but here you are. Analog clock on the chart
https://ctrader.com/algos/indicators/show/1975

@Partial close is not supported in backtesting?:  01 May 2019, 09:21


Hi,

It works in backtesting with 

ModifyPosition(position, newVolume);

@Making a drawed line interactive:  22 Apr 2019, 09:10


Hi,

var line = Chart.DrawHorizontalLine("my line", Symbol.Bid, Color.Red);
line.IsInteractive = true;

@OnMouse Over:  07 Mar 2019, 14:16


Btw there is a bug in API. When a new object is added to a chart bot receive hover event and object is null in the event args.

So you need to check a null check in the example above.

@OnMouse Over:  07 Mar 2019, 14:04


lec0456 said:

I would like to have some text appear on the chart when the mouse rolls over a chart object such as a Chart.DrawVerticalLine.

Is there a way to program this behavior?

Basically, I would think that there is some sort of event that couls be triggered to display a box of text.

The indicators do this by default now.  When you rollover a chart object it displays a small popup that has the name of the indicator, its settings and its current value.

protected override void OnStart()
{
    Chart.ObjectHoverChanged += OnChartObjectHoverChanged;
}

void OnChartObjectHoverChanged(ChartObjectHoverChangedEventArgs obj)
{
    if (obj.IsObjectHovered)
        Chart.DrawStaticText("hoverText", obj.ChartObject.Name, VerticalAlignment.Top, HorizontalAlignment.Left, Chart.ColorSettings.ForegroundColor);
    else
        Chart.RemoveObject("hoverText");
}

@Understanding of the Generic Algo:  25 Feb 2019, 10:56


You can try to tweak your fitness function. Genetic optimization stops when there are no improvements after several iterations (fitness function return the same result). Which means you stuck at the local maximum.

Ideally it would be good to have a sim running on top 10 fitness bots infinately till stopped. (Trying to find better settings).

Don't do this, you will quickly find a local maximum without exploring other possibly more profitable areas.

Here is a very good video lecture from MIT about Genetic Algorithms.
https://www.youtube.com/watch?v=kHyNqSnzP8Y

Besides explaining how GA works, it shows simple examples of how you can stuck on a local maximum without exploring the whole area of possible outcomes.
 

Regards,
Bart

@Small Popup. What does it mean?:  14 Feb 2019, 12:19


ctid863631 said:

Hi Bart,
Thanks for your help. do you also know what the buttons mean? been looking alover for it but no result.

This panel is for working with UI elements while developing WPF or other UI applications: selecting element, change its properties etc.

You can read about it here:

https://devblogs.microsoft.com/visualstudio/introducing-the-ui-debugging-tools-for-xaml/

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.
Favorites
  2
  5
  1226
by bart1
free  03 Feb 2021
Keep you favorite symbols and periods at your fingertips Customizable buttons to switch charts symbol and period fast. For symbols list you need to specify the name of a watchlist from where symbols will be taken. Periods specified as a comma separated values. Customization: Buttons size Font size Button label on one or two lines Position top or bottom   WORKS ONLY ON NEW CTRADER 4.0     Hide buttons to keep chart clean  
Chart Colors
  0
  5
  1342
by bart1
free  08 Jul 2020
Chart Colors has several predefined chart color schemes that you can quickly apply.   Share your color schemes in comments here. I'll will update indicator with shared color schemes. To do this: 1. Go to Automate  2. Create instance for this indicator 3. Click Print Colors to Log button 4. Copy text from Log tab and paste as a comment here
SwitchSymbol
  9
  5
  2042
by bart1
free  25 Jun 2020
The fastest way to switch between favourite symbols. Symbols list can be set with input parameter separated by comma. [Update] Added position parameter  
Auto Drawings
  13
  5
  3171
by bart1
free  29 Oct 2019
How to use: 1) Select bars using Ctrl + Mouse  2) Choose desired drawing in selected area: fibonacci, min/max price level, or support/resistance trend line.   Algorhitm to place trend lines is pretty dumb. It simply draw a line between left and right extremums (when high or low exceed its neigbours). If you know better ideas, please advice. Please share your ideas, what to add to this indicator.
TimeframeSync
  4
  5
  1588
by bart1
free  10 Aug 2021
Syncronize timeframe between different charts. Support different chart groups. Instructions: Add this indicator to all the charts that you want to have the same timeframe. If you want to have more than one group, you should set the Group parameter. When changing timeframe on one chart, all charts with the same group will be switched to the same timeframe. Using the existing feature in cTrader to link charts by the symbol, you can setup workspace like this: Test
Clock
  1
  5
  1826
by bart1
free  26 Jul 2019
Analog clock on the chart using custom UI introduced in cTrader 3.6.  
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
Print Bars
  0
  0
  1081
by bart1
free  02 Oct 2019
Print OHLC and Tick Volume of selected bars to cBot log. Data can be copied to the clipboard from the log. Ctrl + Click to print single bar Ctrl + Mouse Select to print selected bars