It's my first message in the forum!
I would like to instantiate several class signal by a global signal.
But, there is an error with the IOrderMarket. It can't be used by my global signal to trade.
Is it possible to trade in this way ? I don't want to use the Portfolio because the backtest can't calculate Ask and Bid datas in the calculation.
Thank you if you have an advice.
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;
namespace PowerLanguage.Strategy {
public class test_2 : SignalObject {
public test_2(object _ctx):base(_ctx){ctx = _ctx;}
public test_3 T3;
public object ctx;
protected override void Create() {
// create variable objects, function objects, order objects etc.
T3 = new test_3(ctx);
T3.CreateOrder();
}
protected override void StartCalc() {
// assign inputs
}
protected override void CalcBar(){
T3.MyAction();
// strategy logic
}
public class test_3 : SignalObject {
public test_3(object _ctx):base(_ctx){}
public IOrderMarket buy_order;
public void CreateOrder(){
buy_order = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, EOrderAction.Buy));
}
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
//
}
public void MyAction(){
buy_order.Send();
}
}
}
}