Set price with Trailing Stop
Set price with Trailing Stop
04 Aug 2013, 17:58
Hi, in this topic:
/forum/calgo-reference-samples/613
is shown the modified version of the API cAlgo samples.
I wanted to ask how I can edit this robot for adding another parameter that allows me to set the price buy/sell at which to initiate the order.
Replies
Forex19
06 Aug 2013, 17:55
RE:
cAlgo_Fanatic said:
The parameter would be a type double property:
[Parameter] public double Price { get; set; }Then use this parameter in the methods that create the limit order requests instead of the calculation of the price based on the TakeProfitPips.
var request = new LimitOrderRequest(tradeType, Volume, Price)
It is recomended that you validate this input.
I changed that and it seems to work:
private void RequestLimitSell()
{
double targetPrice = Price;
// double targetPrice = Symbol.Bid + TargetPricePips * Symbol.PipSize; (old line)
var request = new LimitOrderRequest(TradeType.Sell, Volume, Price)
// var request = new LimitOrderRequest(TradeType.Sell, Volume, targetPrice) (old line)
and
private void RequestLimitBuy()
{
double targetPrice = Price;
// double targetPrice = Symbol.Ask - TargetPricePips * Symbol.PipSize; (old line)
var request = new LimitOrderRequest(TradeType.Buy, Volume, Price)
// var request = new LimitOrderRequest(TradeType.Buy, Volume, targetPrice) (old line)
@Forex19
cAlgo_Fanatic
05 Aug 2013, 12:49
The parameter would be a type double property:
Then use this parameter in the methods that create the limit order requests instead of the calculation of the price based on the TakeProfitPips.
It is recomended that you validate this input.
@cAlgo_Fanatic