Double a position?
Created at 13 Jun 2015, 06:47
Double a position?
13 Jun 2015, 06:47
In cTrader you are able to double and reverse a position. How can you do that via code? Here's what I've coded so far but I would like to double the position keeping it as one trade at the point I wrote "//double position"
protected override void OnTick() { if (Positions.Count < 1) { ExecuteMarketOrder(TradeType.Sell, Symbol, 10000); } else { foreach (var position in Positions) { if (position.Pips > 5) { ClosePosition(position); } else { if (position.Pips < -10) { //double position } } } } }
Thanks in advance for you help ;)
tradermatrix
13 Jun 2015, 20:39
RE:
Neptune said:
you can not build your robot in this way ..
you reduce to 1 order (if Positions.Count <1)" you can not place another reverse order (count = 2)
if takeprofit sell order is executed first:
must cancel order buy X2.
I do not know the code of your robot and what you want to do.
but look if my sample can help.
@tradermatrix