Add expiration..?
Add expiration..?
06 Dec 2013, 15:14
How do I add an expiry time of 5 minutes to this:
private void Buy()
{
PlaceLimitOrder(TradeType.Buy, Symbol, 10000, Symbol.Bid - 1.5 * Symbol.PipSize);
}
I've toyed around with "DateTime expiry = DateTime.Now.AddMinutes(30);" for ages but i'ts always expecting a "." and extra commands.
Replies
Spotware
06 Dec 2013, 16:56
The correct time setting for the expiration should be based on server time instead of local time.
The syntax for the order commands expects the arguments in a certain order. If arguments are to be ommited, a null should be specified in their place.
DateTime expiry = Server.Time.AddMinutes(5); PlaceLimitOrder(TradeType.Buy, Symbol, 10000, Symbol.Bid - 1.5 * Symbol.PipSize, null, null, null, expiry);
See more examples here: /api/robot/placelimitorder-6205
@Spotware
Kevin
09 Dec 2013, 00:02
Adding "using System" solves the problem with the buy order, but another fault comes up with the sell order:
private void Sell()
{
DateTime expiry = Server.Time.AddMinutes(5);
PlaceLimitOrder(TradeType.Sell, Symbol, 10000, Symbol.Sell + 0.5 * Symbol.PipSize, null, null, null, expiry);
}
Error: 'cAlgo.API.Internals.Symbol' does not contain a definition for 'Sell" and no extension method 'Sell" accepting a first arguement or type 'cAlgo.API.Internals.Symbol' could not be found (are you missing a using directive o...
@Kevin
Kevin
06 Dec 2013, 15:16
I have also played around with this:
But keep having the same problem.
@Kevin