US
help plz
29 Jul 2019, 16:20
please help me for creating sample code
closing all positions with only net profit reached of any amount of money , and i can make this code works in 4 of 5 or 6 pairs in the same time >
thank you

PanagiotisCharalampous
29 Jul 2019, 16:46
Hi useretinv,
See an example below
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } protected override void OnStart() { // Put your initialization logic here } protected override void OnTick() { foreach (var position in Positions) { if (position.NetProfit > 0 && position.SymbolName == Symbol.Name) position.Close(); } } protected override void OnStop() { // Put your deinitialization logic here } } }Best Regards,
Panagiotis
@PanagiotisCharalampous