How to Create a cTrader cBot Template (2024)

The correct method to create a new cBot is to first open the cTrader trading platform and then click on the Automate tab, this is where you will build and run your custom cBots and indicators if you need help with navigating your way around the cTrader platform follow the link below.

You can easily create a new cBot by just clicking on the NEW button, this will create asimple blank templateorcommon code framework used with all your cBots.

Now you will seein the code editor on the right panel the source code below.

Let us break the code down and explain each part to you, the using keyword you see will referenceexistinglibraries (assemblies).

The first section of the code above simply grabs existing functionality from the .NET framework so that you do not need to re-invent the wheel and create logical code blocks that already exist.

usingcAlgo.API; usingcAlgo.API.Indicators; usingcAlgo.API.Internals; usingcAlgo.Indicators;

The referenced assemblies above show the cTrader API libraries, it is these libraries that you will use to interface with cTrader for trading and displaying indicators.

Class Attributes

Anattributeis a declarative tag that is used to convey information to runtime about the behaviours of the cBot class, the attribute used with our cBot has a few options.

[Robot(TimeZone = TimeZones.UTC)]

The attribute above is the default template,the timezone that you choose, in this case, UTC will be the server time used in the robot.

[Robot(TimeZone=TimeZones.UTC,AccessRights=AccessRights.FullAccess)]

Another attribute setting for the cBot is the access rights, what this means is that when the cBot runs within cTrader how much access does the code within has on the user's machine.

Anattributeis actually an object that is associated with any of these elements: Assembly, Class, Method, Delegate, Enum, Event, Field, Interface, Property and Struct.

Robot Interface Implementation

The class implements the Robot interface using the line of code below, the colon and Robot name is used. What this does is allow events that happen, some of the events are when the robot starts when the robot stops and on every price change.

public classNewcBot: Robot

It is always a good idea to change the name of your cBot and the class name to something more meaningful that has something to do with your project, if your project involved a moving average strategy, then call it Moving Average Strategy.

cBot User Defined Parameters

This is the area where you will be defining your cBot adjustable settings, you can specify only a certain data type to use, in the example below it is using a double and the name of the parameter is Parameter with a default value of 0.00.

Parameter(DefaultValue = 0.0)] public double Parameter { get; set; }

If you wish to create an email address entry and group your parameter settings you can use the keyword Group keyword, the example below shows a user setting for the cBot to allow an email address to be entered with a default value of [email protected].

[Parameter("Email Address", DefaultValue = "[email protected]", Group = "Notifications")]

public string EmailAddress{ get; set; }

How to Create a cTrader cBot Template (1)

Custom Enums as DataTypes

It is also possible to define a dropdown list of options for adjustable cBots settings.

public enum ClosingStrategy { StopLoss, TrailingStop, OppositeSignal }

public class NewcBot : Robot { [Parameter("Closing Strategy")]

public ClosingStrategy ClosingStrategy { get; set; } }

How to Create a cTrader cBot Template (2)

cBot Events

The basic template will capture 3 events that will occur with the cBot when it starts, stops and when the price changes, there are many other events now available.

  • Further Reading on cTrader cBot Events

Build The cBot

Once you are ready you just need to build your cBot by right-clicking your mouseon the cBot in the Automate screen and choosing Build.

How to Create a cTrader cBot Template (2024)
Top Articles
5 Things Not to Say to Someone With a Chronic Illness
Jeff Bezos’ 417-Foot Yacht Drops Anchor in South Florida amid Move to Miami
Ups Stores Near
Access-A-Ride – ACCESS NYC
Apex Rank Leaderboard
Fototour verlassener Fliegerhorst Schönwald [Lost Place Brandenburg]
Vocabulario A Level 2 Pp 36 40 Answers Key
Corporate Homepage | Publix Super Markets
Hello Alice Business Credit Card Limit Hard Pull
World of White Sturgeon Caviar: Origins, Taste & Culinary Uses
Iron Drop Cafe
W303 Tarkov
Hope Swinimer Net Worth
Shemal Cartoon
Miss America Voy Forum
Zürich Stadion Letzigrund detailed interactive seating plan with seat & row numbers | Sitzplan Saalplan with Sitzplatz & Reihen Nummerierung
Inevitable Claymore Wow
Price Of Gas At Sam's
Chastity Brainwash
Virginia New Year's Millionaire Raffle 2022
Inter-Tech IM-2 Expander/SAMA IM01 Pro
Buy Swap Sell Dirt Late Model
Daylight Matt And Kim Lyrics
Jbf Wichita Falls
Apply for a credit card
MLB power rankings: Red-hot Chicago Cubs power into September, NL wild-card race
Masterkyngmash
Pasco Telestaff
Sec Baseball Tournament Score
How to Watch Every NFL Football Game on a Streaming Service
Disputes over ESPN, Disney and DirecTV go to the heart of TV's existential problems
2015 Kia Soul Serpentine Belt Diagram
Rgb Bird Flop
L'alternativa - co*cktail Bar On The Pier
Autopsy, Grave Rating, and Corpse Guide in Graveyard Keeper
Moxfield Deck Builder
Muma Eric Rice San Mateo
Laurin Funeral Home | Buried In Work
The Best Restaurants in Dublin - The MICHELIN Guide
craigslist | michigan
Bones And All Showtimes Near Johnstown Movieplex
Shuaiby Kill Twitter
Anguilla Forum Tripadvisor
התחבר/י או הירשם/הירשמי כדי לראות.
Updates on removal of DePaul encampment | Press Releases | News | Newsroom
Discover Things To Do In Lubbock
Anthem Bcbs Otc Catalog 2022
Southwest Airlines Departures Atlanta
Kjccc Sports
Www.homedepot .Com
BYU Football: Instant Observations From Blowout Win At Wyoming
Latest Posts
Article information

Author: Arielle Torp

Last Updated:

Views: 6360

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Arielle Torp

Birthday: 1997-09-20

Address: 87313 Erdman Vista, North Dustinborough, WA 37563

Phone: +97216742823598

Job: Central Technology Officer

Hobby: Taekwondo, Macrame, Foreign language learning, Kite flying, Cooking, Skiing, Computer programming

Introduction: My name is Arielle Torp, I am a comfortable, kind, zealous, lovely, jolly, colorful, adventurous person who loves writing and wants to share my knowledge and understanding with you.