TWM Wiki
TWM allows users to write their own extendable modules using C# language. In this section you will find tutorials and help on main API. TWN is installed together with a Custom
project file where user is capabale of writing code. You can use any IDE of your choice. In our documentation we will be demonstrating everyhting with the help of Visual Studio Community Edition wich is a free IDE that can be downloaded from here.
Your intial installation will place the TWMCustom project here C:\Users\User\Documents\Twm\bin\Custom
. In order to start working with the custom project locate this folder and open the project or solution file Twm.Custom.csproj
or Twm.Custom.sln
You can compile the custom project from within the IDE or by running any compilation commands from within TWM. You can learn more about compiling and debuging here.
In order to Debug your project using an external IDE please read this section You may alternatively debug using the Debug window of TWM found in Admin panel New -> Debug
. Use the below command to print to Debug window.
All parameters should be prefixed with a [TwmProperty]
tag. In case if this is an Indicator parameter it will allow it to be passed to TWM code auto generator upon compilation and become accessable inside the strategy code. In the case with the Strategy it will allow this parameter to become available inside the Optimizer
.
The parameter defaults should be assigned inside the OnStateChanged event
Whenever a strategy or indicator changes state the OnStateChanged
event takes place. We are able to get the current new state of the object and work with it. Some global parameters such as Name and Version should be set here.
All historical and live execution of TWM strategies and indicators occurs OnBarClose
. Please use the demonstrated method below to create your code logic inside these overrides. To adress current bar values please use the zero index as below. Previous bar index would be 1 in this case etc. Please note that if you address a bar that does not exist on the chart you will get an index out of range exception. For instance, if there are only 5 bars on the chart and you try and look back at Close[6] you will get an exception.
During live execution of TWM strategies and indicators you can also use OnTickUpdate
to execute your business on a tick by tick basis. You can address the live candle values appropriatly.
OnOrderUpdate
event will occur every time there is any change inside the strategy order. Use this to control your orders during historical strategy execution.
OnExecutionUpdate
will occur only when something occurs to the order during live
exectuion ie. on the connection provider side. The OnExecutionUpdate event executes when we get a callback from the exchange only, it will not execute during historical strategy execution. Please make sure you use OnOrderUpdate during historical execution.
It is possible to add an additional data series to indicator or strategy and work with that series. SymbolName string is optional, if nothing is passed the data series will be enabled on the same instrument.
Symbol name should be specified exactly as it is listed in the instrument list. Please also specify the type as SPOT
or FUTURE
. The available connection short names are BybitMainnet
and/or BinanceMainnet
. You can add as many data serieses as you like.
To address data contained with the added data seriese pelase use the below syntax.
If you would like to submit a LIVE
order against an added data series please use the selected bars in progress parameter available inside each order method. In the case below the order will be submitted to the first added extra series.
Comissions is an extendable TWM module. There are several pre-configured set ups available. The comissions are calculated at the end of each trade and we have a chance to interact with the trade data in order to make extra calculations. The returned comissions value will be deducted from the total pnl of the trade. Below is an example of most popular % based comission calculation.
TWM is already preset with spot and futures comissions presets for taker and maker options.
You can access and code your own optimization fitness coefficient. Please look for examples in the optimization fitness folder. The optimzer will always try and find the max Value
parameter that you pass from here.
This website uses cookies to enhance your browsing experience. By continuing to use our website, you agree to our Privacy Policy
Necessary cookies help make a website usable by enabling basic functions such as page navigation and access to protected areas of the site.
Necessary cookies
Indicates whether the user has consented to the use of necessary cookies.
Maximum storage duration: 1 Year | Type:Necessary cookiesUsed to prevent CSRF attacks and protect user data.
Maximum storage duration: Session | Type: Necessary cookiesUsed to manage authentication information and the user's session.
Maximum storage duration: 1 Year | Type: Necessary cookiesUsed to store user's language preferences.
Maximum storage duration: 1 Year | Type: Necessary cookiesSecurity cookie set by Google to authenticate users and prevent fraudulent use of login credentials.
Ensures you stay connected to your Google accounts across various services.
Maximum storage duration: 2 Years | Type: Necessary cookiesUsed to verify your Google account and ensure that requests in sessions come from you.
Maximum storage duration: 6 Months | Type: Necessary cookiesSecurity cookie used by Google to authenticate users and prevent fraudulent use of login credentials, protecting user data.
Maximum storage duration: 2 Years | Type: Necessary cookiesThis cookie prevents the browser from sending the cookie along with cross-site requests, helping to mitigate the risk of cross-origin information leakage.
Maximum storage duration: 6 Months | Type: Necessary cookiesImportant for Google's security and to ensure that Google can authenticate the account and block fraudulent access attempts.
Maximum storage duration: 2 Years | Type: Necessary cookiesSecurity cookie to protect user data from unauthorized access.
Maximum storage duration: 1 Year | Type: Necessary cookiesCrucial cookies to ensure that you remain securely logged into your Google accounts while accessing various Google services.
Maximum storage duration: 2 Years | Type: Necessary cookies
Functional cookies allow the website to provide enhanced functionality and personalization. They may be set by the website owner or by third parties whose services have been added to the pages.
Functional Cookies
Used by Google to store session information and enhance the user's experience on Google services.
Used by Google to improve user navigation by remembering preferences and information, such as preferred language.
Maximum storage duration: 6 Months | Type: Functional CookiesRemembers which accounts have been used to log into Google services on the device.
Maximum storage duration: 1 Year | Type: Functional CookiesUsed by Google to store user preferences and information when viewing pages with Google maps.
Maximum storage duration: 2 Years | Type: Functional CookiesUsed by Google to store user preferences while viewing pages that incorporate Google services.
Maximum storage duration: 2 Years | Type: Functional CookiesUsed by Google to remember user preferences, such as preferred language, to provide a more personalized experience.
Maximum storage duration: 6 Months | Type: Functional CookiesUsed by Google to collect information about visitors for videos hosted on YouTube or maps integrated with Google Maps.
Maximum storage duration: 2 Years | Type: Functional CookiesUsed by Google to store user preferences and information when pages containing maps or Google services are viewed.
Maximum storage duration: 2 Years | Type: Functional Cookies
Statistical cookies help website owners understand how visitors interact with the site by collecting and transmitting information anonymously.
Statistical Cookies
Unique identifier used to track user interactions and maintain unique sessions.
Microsoft cookie that collects data on user interactions to improve services.
Maximum storage duration: 7 days | Type: Statistical CookiesUsed by the Microsoft Clarity analytics suite to maintain the user's session.
Maximum storage duration: Session | Type: Statistical Cookies
Marketing cookies are used to track visitors on websites. The intent is to display relevant and engaging ads for the individual user.
Marketing Cookies
Used by Google to link your activity across devices if you have logged in with the same Google account.
Used by Microsoft Advertising to check the anonymity of data sent by tracking cookies.
Maximum storage duration: 10 minutes | Type: Marketing CookiesMicrosoft cookie used to track user interactions across Microsoft domains.
Maximum storage duration: 13 Months | Type: Marketing CookiesGoogle cookies designed to build a profile of your preferences and show you relevant ads on other sites, protecting the Google account.
Maximum storage duration: 2 Years | Type: Marketing CookiesUsed by Google to identify and track visitors across various websites to display personalized advertising.
Maximum storage duration: 2 Years | Type: Marketing CookiesUsed by Google to personalize ads on Google properties, like Google Search.
Maximum storage duration: 1 Month | Type: Marketing CookiesUsed by Google to deliver more relevant ads and protect the security of your preferences and Google account information.
Maximum storage duration: 2 Years | Type: Marketing CookiesCookies are small text files that can be used by websites to make the user's experience more efficient.
The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies, we need your permission. This means that cookies classified as necessary are processed under Article 6(1)(f) of the GDPR. All other cookies, namely those belonging to the categories of preferences and marketing, are processed under Article 6(1)(a) of the GDPR.
This site uses different types of cookies. Some cookies are placed by third-party services that appear on our pages.
You can change or revoke your consent at any time from the Cookie Statement on our website.
Learn more about who we are, how you can contact us, and how we process personal data in our Privacy Policy.
Specify your consent ID and the date you contacted us regarding your consent.