美版MC 使用

时间:2021-02-05 20:52:35

备份

C:\ProgramData\TS Support\MultiCharts .NET\StudyServer\Techniques\CS

pledit 无法打开 解决方法

regedit

hkey_current_user\software 下面删除 ts support  文件夹

直接使用 VS2010 进行 开发 。

安装 VS2010  可以直接使用C:\ProgramData\TS Support\MultiCharts .NET\StudyServer\Techniques\CS\PLStudies2010.sln 开发 。 注意模板

1、使用序列的function

//-------------------------------

HTTP.Function.cs

using System;

using System.Drawing;

using System.Linq;

namespace PowerLanguage

{

namespace Function

{

public sealed class HTTP : FunctionSeries<System.Double>

{

public aaa(CStudyControl _master) : base(_master) { }

public aaa(CStudyControl _master, int _ds) : base(_master, _ds) { }

protected override void Create()

{

// create variable objects and function objects

}

protected override void StartCalc()

{

// assign inputs

}

protected override System.Double CalcBar()

{

// function logic

return default(System.Double);

}

}

}

}

//-------------------------------

2、指标模板

//-------------------------------

bbb.Indicator.cs

using System;

using System.Drawing;

using System.Linq;

using PowerLanguage.Function;

namespace PowerLanguage.Indicator{

public class bbb : IndicatorObject {

public bbb(object _ctx):base(_ctx){}

private IPlotObject plot1;

protected override void Create() {

// create variable objects, function objects, plot objects etc.

plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));

}

protected override void StartCalc() {

// assign inputs

}

protected override void CalcBar(){

// indicator logic

plot1.Set(Bars.Close[0]);

}

}

}

//-------------------------------

3、信号模板

//-------------------------------

ccc.Strategy.cs

using System;

using System.Drawing;

using System.Linq;

using PowerLanguage.Function;

using ATCenterProxy.interop;

namespace PowerLanguage.Strategy {

public class ccc : SignalObject {

public ccc(object _ctx):base(_ctx){}

private IOrderMarket buy_order;

protected override void Create() {

// create variable objects, function objects, order objects etc.

buy_order = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, EOrderAction.Buy));

}

protected override void StartCalc() {

// assign inputs

}

protected override void CalcBar(){

// strategy logic

buy_order.Send();

}

}

}

//———————————————----------------

获取 当前订单数量

int x = Positions[0].OpenTrades.Count;

 
获取 最近 最高价  最低价 

HighestFC highest;

highest = new HighestFC(this);

highest.len = 50;

highest.pricevalue = Bars.High;

 

引用DLL

  • For C# dll you need to add a reference in PowerLanguage .Net Editor (Right click on the workarea with the code in PowerLanguage .Net Editor->References-> Add reference/Add global reference).
  • For C++ dll you need to reference the functions that are provided by this dll for ex:
     
    [DllImport( "mTestMCdll.dll", CharSet = CharSet.Unicode )]
    public static extern void CreateGPanelHDCHWND( IntPtr hdc, IntPtr hwnd );

二图表 的相关数据

BarsOfData(2).Close

二图表的 指标  ADX _a = new ADX(this,2);

定义 introbar

[IOGMode(IOGMode.Enabled)]