Volume Sequence in Pending Order
Volume Sequence in Pending Order
10 Oct 2016, 16:05
How can I declare a volume sequence in pending order?
For example I started a pending order in 1K volume then I want the next pending order to be created in 2k volume when the first 1k volume pending order triggered..
Thanks in Advance!
Replies
richard_alcaide
11 Oct 2016, 02:34
RE:
lucian said:
You can try something like this:
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class alcaide : Robot { [Parameter("Volume", DefaultValue = 1000)] public int Volume { get; set; } protected override void OnStart() { Positions.Opened += openedposition; PlaceStopOrder(TradeType.Sell, Symbol, Volume, Symbol.Ask - (5 * Symbol.PipSize), Volume.ToString()); } public void openedposition(PositionOpenedEventArgs arg) { var pos = arg.Position; var volume = pos.Label; int vol = Int32.Parse(volume); vol = Volume + vol; PlaceStopOrder(TradeType.Sell, Symbol, vol, pos.EntryPrice - (5 * Symbol.PipSize), vol.ToString()); } } }
Thanks Lucian but with your code given how can I create a pending order sequence like these below?
Pending Buy Order = 1000, 1000, 1900
Pending Sell Order = 1400, 1400, 2500
@richard_alcaide
... Deleted by UFO ...
richard_alcaide
14 Oct 2016, 13:29
RE:
Thank You Lucian..
Try to put volume sequence in a list:
var Buy_sequence= new List{1000, 1000, 1900};
and use Buy_sequence[0] for first buy pending order, Buy_sequence[1] for second buy pending order, etc.
@richard_alcaide
richard_alcaide
18 Oct 2016, 20:08
RE: RE:
Hi Lucian I still can't make it work, can you give me sample how to code this please..
Try to put volume sequence in a list:
var Buy_sequence= new List{1000, 1000, 1900};
and use Buy_sequence[0] for first buy pending order, Buy_sequence[1] for second buy pending order, etc.
@richard_alcaide
... Deleted by UFO ...
... Deleted by UFO ...