i have a strategy to calculate ordres for stock with low liquidity (3 to 5 price updates per minute)
strategy uses IOG = true
i use ExecControl.RecalcLastBarAfter() to force my strategy to recalculate
orders all x-seconds
but the new calculated order are sent to Broker (IB) only after the next price tick arrived
how i can force strategy to send orders to broker immediately without waiting for a new price update?
Broker : IB
MC.NET
How to send orders immediately to broker ?
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: How to send orders immediately to broker ?
Hello, radekj!
You need to use this attribute: [AllowSendOrdersAlwaysAttribute(true), IOGMode(IOGMode.Enabled)]
It allows for sending orders when Barstatus = -1
Code example:
You need to use this attribute: [AllowSendOrdersAlwaysAttribute(true), IOGMode(IOGMode.Enabled)]
It allows for sending orders when Barstatus = -1
Code example:
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;
namespace PowerLanguage.Strategy
{
[AllowSendOrdersAlwaysAttribute(true), IOGMode(IOGMode.Enabled)]
public class low_liquidity : SignalObject
{
public low_liquidity(object _ctx):base(_ctx)
{
buy_stop_pr = 1;
}
[Input]
public double buy_stop_pr { get; set; }
private IOrderPriced buy_order_stop;
private double price_stop;
protected override void Create()
{
buy_order_stop = OrderCreator.Stop(new SOrderParameters(Contracts.Default, EOrderAction.Buy));
}
protected override void StartCalc()
{
}
protected override void CalcBar()
{
price_stop = price_stop + 0.1;
if (price_stop >= 1)
{
price_stop = 0;
}
buy_order_stop.Send(buy_stop_pr + price_stop);
ExecControl.RecalcLastBarAfter(new TimeSpan(0, 0, 0, 1));
Output.WriteLine(price_stop.ToString());
}
protected override void OnRecalcLastBarAfterEvent()
{
this.CalcBar();
}
}
}