Help
Help
15 Oct 2013, 20:13
I have made a profitabel robot, but it only runs one cycle.
Right now i have my logich on OnStart(), but if i but it on on tick it makes over a 1000 positionsn
So if someone have a code for: When the position closes go back to start. (Repit)
Or a order limiter. ( Max Orders)
Thanks!
Replies
Old Account
16 Oct 2013, 10:49
RE: RE:
Cerunnos said:
MRSV said:
I have made a profitabel robot, but it only runs one cycle.
Right now i have my logich on OnStart(), but if i but it on on tick it makes over a 1000 positionsn
So if someone have a code for: When the position closes go back to start. (Repit)
Or a order limiter. ( Max Orders)
Thanks!
With the following simple solution you can limit maximum order number to one...
private bool IsOpenPos = false;
...protected override void OnTick()
{
if (!IsOpenPos)
{
if (_TDI.PriceSeries[Index] > _TDI.Middle[Index] && _TDI.PriceSeries[Index] > _TDI.SignalSeries[Index]) ...
var request = new MarketOrderRequest(TradeType.Buy, vol)
{
Label = "m10_Robot",
SlippagePips = 50,
StopLossPips = init_StopLoss
};
Trade.Send(request);
IsOpenPos= true;
}
}
protected override void OnPositionClosed(Position closedPosition)
{
IsOpenPos = false;
}
Thanks a lot Ceruunos!
@Old Account
Cerunnos
16 Oct 2013, 09:38
RE:
MRSV said:
With the following simple solution you can limit maximum order number to one...
private bool IsOpenPos = false;
...
protected override void OnTick()
{
if (!IsOpenPos)
{
if (_TDI.PriceSeries[Index] > _TDI.Middle[Index] && _TDI.PriceSeries[Index] > _TDI.SignalSeries[Index]) ...
var request = new MarketOrderRequest(TradeType.Buy, vol)
{
Label = "m10_Robot",
SlippagePips = 50,
StopLossPips = init_StopLoss
};
Trade.Send(request);
IsOpenPos= true;
}
}
protected override void OnPositionClosed(Position closedPosition)
{
IsOpenPos = false;
}
@Cerunnos