The Microsoft .NET environment has a rich class library that you can access when developing custom indicators and strategies. There is a plethora of information available online and in print that details language syntax, class libraries in great depth. Below are quick links to the Microsoft Developers Network for some of the basic classes whose functionality you may harness when developing in NinjaScript.
Complete list of classes in the Microsoft .NET environment. Also main .Net functions you are able to find in this help.
MSDN (Microsoft Developers Network) C# Language Reference
MSDN (Microsoft Developers Network) Visual Basic Language Reference
Example
// Example of the Max method of the System.Math class
int myInteger = Math.Max(10, 20);
Print("The larger value between 10 and 20 is " + myInteger.ToString());
For all .NET scripts you need to declare PTLRuntime.NETScript namespace to use platform and language-specific functions. ProTrader Desktop automaticaly detects PTLRuntime.dll from ProTrader installation directory.
All nesessary trading functions, methods, operations you can find in platform class. See Dictinary panel to find description and list of available functions for this class (platfrom classes availble in ProTrader language tree). If the is no proper function in platform class, then you can use mql2, mql4, el or ptl classes. Example of using platform and mql4 classes is bellow.
Example
using System;
using System.Text;
using PTLRuntime.NETScript;
namespace myUntitled1
{
public class myUntitled1 : NETStrategy
{
public override void Init() {
platform.Print("period is ", mql4.Period());
}
}
}
Note: Methods Comment, Print, Alert, iCustom, iCustomOnArray are availbale only in platform collection.You can't use mql4.comment, etc.
Comments