Topics
30 Aug 2024, 11:09
 0
 181
 0
15 Aug 2024, 13:12
 0
 183
 0
23 Jul 2024, 17:30
 0
 256
 0
02 Jun 2024, 00:49
 2
 388
 3
14 Apr 2024, 00:05
 388
 4
15 Jan 2024, 06:08
 510
 3
Replies

Waxy
01 Mar 2016, 22:37

Thank you guys, I hope they add this functionality in the future soon.

Also croucrou that's a GUI extension and not sure how to do it.


@Waxy

Waxy
01 Mar 2016, 16:16

I-ve tried some time ago with no success using diferent types of variables, but I don-t really get it, you can use a menu to select the currency pair on where the cbot will work, why it shouldn-t work when we try to do it?


@Waxy

Waxy
29 Feb 2016, 20:06

as Spotware said,

you should check PendingOrders.Count instead


@Waxy

Waxy
29 Feb 2016, 20:05

Hello,

You should try:

        int MaxNumber = 10;

        protected override void OnStart()
        {

            if (Positions.Count > MaxNumber)
            {
                foreach (var pos in Positions)
                {
                    ClosePosition(pos);
                }
            }
        }

 


@Waxy

Waxy
23 Feb 2016, 00:48

I think the options you have right now is to make a bot to use adx and draw a line or text at a specified location when it is above 20.


@Waxy

Waxy
23 Feb 2016, 00:46 ( Updated at: 21 Dec 2023, 09:20 )


@Waxy

Waxy
23 Feb 2016, 00:41

//For limit pending orders

            if (PendingOrders != null)
            {
                foreach (var pending in PendingOrders)
                {
                    if (pending.SymbolCode == "EURUSD" && pending.OrderType == PendingOrderType.Limit)
                    {
                        //Do stuff here
                    }
                }
            }

 


@Waxy

Waxy
23 Feb 2016, 00:39

// For positions

            if (Positions != null)
            {
                foreach (var pos in Positions)
                {
                    if (_pos.SymbolCode == "EURUSD")
                    {
                        //do stuff here
                    }
                }
            }

//-----------------

// For pending orders

            if (PendingOrders != null)
            {
                foreach (var pending in PendingOrders)
                {
                    if (pending.SymbolCode == "EURUSD")
                    {
                        //Do stuff here
                    }
                }
            }

 


@Waxy

Waxy
29 Jan 2016, 03:42

Hello Fredrik

Please refer to the jobs section, a developer will surely assist you.

Best Regards.


@Waxy

Waxy
29 Jan 2016, 03:22

Hello

Please refer to the jobs section.

Best Regards


@Waxy

Waxy
17 May 2015, 03:09

Hello

You assign a label for each algorithm running, this way bots wont interfere each other.


@Waxy

Waxy
13 May 2015, 03:39

Here's the code, please notice, you didn't say anything about the 1st position being closed.

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 XROpenPositionsinOpposed : Robot
    {
        [Parameter("Label", DefaultValue = "MyLabel")]
        public string MyLabel { get; set; }

        bool _isSent;

        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, MyLabel);
        }

        protected override void OnTick()
        {
            var x = Positions.Find(MyLabel);

            if (x != null && !_isSent)
            {
                if (x.TradeType == TradeType.Buy)
                {
                    PlaceStopOrder(TradeType.Sell, Symbol, (x.Volume * 2), x.EntryPrice - 20 * Symbol.PipSize);
                    _isSent = !_isSent;
                }
                else
                {
                    PlaceStopOrder(TradeType.Buy, Symbol, (x.Volume * 2), x.EntryPrice + 20 * Symbol.PipSize);
                    _isSent = !_isSent;
                }
            }
        }
    }
}

 


@Waxy