using System; using System.ComponentModel; using System.IO; using System.Runtime.InteropServices.ComTypes; using TSLab.Script.Handlers.Options; using TSLab.Script.Options; namespace TSLab.Script.Handlers { [HandlerCategory("Test")] [HelperName("Positions log", Language = "en-US")] [HelperName("Логирование данных о позиции", Language = "ru-RU")] [InputsCount(1)] [Input(0, TemplateTypes.POSITION, Name = "POSITIONSource")] [OutputsCount(0)] [Description("Цена сделки, по которой открылась позиция. Для режима реальных торгов это цена по которой была выставлена заявка на открытие позиции.")] [HelperDescription("The price of the trade at which the position was opened. In the trading mode this is the price at which the position opening order was placed.", "en-US")] public class test : IValuesHandler, IHandler, IOneSourceHandler, IPositionInputs { public void Execute(IPosition pos, int barNum) { if (pos!= null && barNum == pos.EntryBarNum +1) { var sw = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)+@"\Logs.txt", true); sw.WriteLine(pos.EntryBarNum); sw.Close(); } } } }