Only one stop order tick mode
Created at 08 Jan 2018, 17:30
TR
Only one stop order tick mode
08 Jan 2018, 17:30
Hello
to fix my positions I use this formula that works well ...
var cBotPositions = Positions.FindAll (RobotID)
if (cBotPositions.Length > = 1)
return;
Does anyone have an equivalent formula for PendingOrders(limit ou stop)?
cordially
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Collections; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Reflection; using System.Threading; using System.Diagnostics; using Microsoft.Win32; using cAlgo.API.Requests; using System.Text; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class HigGFrequency : Robot { [Parameter("HigHFreQuencY Label n°", DefaultValue = "1")] public string RobotID { get; set; } [Parameter("Pip Step", DefaultValue = 7, MinValue = 1)] public int PipStepB { get; set; } [Parameter("First Quantity(Lots)", DefaultValue = 0.1, MinValue = 0.01, Step = 0.01)] public double Quantity { get; set; } [Parameter("Cancel Stop Order(MINUTES)", DefaultValue = 120)] public int MINUTES { get; set; } [Parameter(DefaultValue = 160)] public int SL { get; set; } [Parameter(DefaultValue = 40)] public int TP { get; set; } ////////////////////////////////////////////////////////////////////////////////////// protected override void OnTick() { Play(); } private void Play() { var volumeInUnits = Symbol.QuantityToVolume(Quantity); { var buyOrderTargetPrice = Symbol.Ask + PipStepB * Symbol.PipSize; DateTime exp = MarketSeries.OpenTime.LastValue.AddMinutes(MINUTES); PlaceStopOrder(TradeType.Buy, Symbol, volumeInUnits, buyOrderTargetPrice, RobotID, SL, TP, exp); } } } }