I am transitioning from TS, so I am new to this forum. I converted most of my code to c#. I have a few shortcomings left.
I am using a Renko chart. I am trying to update the prices of my stop or limit orders based on certain conditions within the bar (ie before the last bar closes). Orders are placed at the end of a bar.
Does anyone know how to enable IntraBarOrderGeneration for a Renko chart?
Or some other way to call the RecalcLastBarAfter() function and have the last bar?
here is a piece of code that I am testing with. The recalc event fires, but the orders do not get updated:
Code: Select all
protected override void CalcBar()
{
if (Bars.LastBarOnChart)
{
Point = Bars.Info.ASymbolInfo2.MinMove / Bars.Info.ASymbolInfo2.PriceScale;
buy_order.Send(4000);
sell_Limit_1.Send(Bars.Close[0] + 10 * Point, 2000);
sell_Stop_1.Send(Bars.Close[0] - 20 * Point, 4000);
ExecControl.RecalcLastBarAfter (new TimeSpan(0,0,0,45,0));
}
}
protected void OnRecalcLastBarAfterEvent()
{
this.CalcBar();
}
Erol