Opening Multiple Market Orders in one click

Created at 03 Mar 2017, 22:49
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
DA

Opening Multiple Market Orders in one click
03 Mar 2017, 22:49


 

How to Open Multiple Market Orders in one click,

Instead of opening one standard lot market order, could prefer to open ten .1 lot or one hundred .01 lot instead,

Can you show me the Algo script ?

Thank you


@davideng5841@hotmail.com
Replies

kricka
06 Mar 2017, 17:30

The Market Order 2.0 can solve this but you need to open up several windows with the cBot and configure them differently.

Have a look at the information and the download link here: Market Order 2.0


@kricka

... Deleted by UFO ...

davideng5555
06 Mar 2017, 20:35

RE:

kricka said:

The Market Order 2.0 can solve this but you need to open up several windows with the cBot and configure them differently.

Have a look at the information and the download link here: Market Order 2.0

 

Thank you for very much,

And is there any way to open ten, twenty market orders with a single click?

 

 

 


@davideng5555

davideng5555
07 Mar 2017, 09:23

RE:

lucian said:

You can start with this code:

 

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 NewcBot : Robot
    {
        [Parameter("Lot Size", DefaultValue = 0.01)]
        public double lot { get; set; }
        [Parameter("Positions nr.", DefaultValue = 100)]
        public int nr { get; set; }
        [Parameter("Buy ?")]
        public bool buy { get; set; }
        [Parameter("Sell ?")]
        public bool sell { get; set; }
        protected override void OnStart()
        {
            long volume = Symbol.QuantityToVolume(lot);
            if (buy)
            {
                for (int i = 0; i < nr; i++)
                    ExecuteMarketOrder(TradeType.Buy, Symbol, volume);
            }
            if (sell)
            {
                for (int i = 0; i < nr; i++)
                    ExecuteMarketOrder(TradeType.Sell, Symbol, volume);
            }
        }


    }
}

Thank You very much lucian,

Got it worked and running, that's my first build from your script.

Better than intended as it can be use manually or get the exact amount filled, took a while though.

Cheers.

David

 

 


@davideng5555

gayanasa
28 Jun 2019, 05:52

RE:

lucian said:

You can start with this code:

 

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 NewcBot : Robot
    {
        [Parameter("Lot Size", DefaultValue = 0.01)]
        public double lot { get; set; }
        [Parameter("Positions nr.", DefaultValue = 100)]
        public int nr { get; set; }
        [Parameter("Buy ?")]
        public bool buy { get; set; }
        [Parameter("Sell ?")]
        public bool sell { get; set; }
        protected override void OnStart()
        {
            long volume = Symbol.QuantityToVolume(lot);
            if (buy)
            {
                for (int i = 0; i < nr; i++)
                    ExecuteMarketOrder(TradeType.Buy, Symbol, volume);
            }
            if (sell)
            {
                for (int i = 0; i < nr; i++)
                    ExecuteMarketOrder(TradeType.Sell, Symbol, volume);
            }
        }


    }
}

thanks its very usefull coding .. thanks your help for others. becuase i am not devolper ... thank you so much its working grate.. 

 


@gayanasa