StopOrders tool for manual grid trading help please

Created at 13 May 2015, 05:59
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!
RC

rcc25

Joined 04.01.2013

StopOrders tool for manual grid trading help please
13 May 2015, 05:59


// ---------------------------------------------------------------------------------------
//
//    In "StopOrder" cBot places a Stop order on start, with a label 
//    representing the robot, symbol and timeframe of the instance.
//    On each tick it checks if the order has been filled.
//
// ---------------------------------------------------------------------------------------
using cAlgo.API;

namespace cAlgo.Robots
{
    [Robot()]
    public class StopOrder : Robot
    {

        [Parameter(DefaultValue = "StopOrder cBot")]
        public string RobotLabel { get; set; }

        [Parameter(DefaultValue = 10)]
        public int Target { get; set; }

        [Parameter(DefaultValue = 10000, MinValue = 1000)]
        public int Volume { get; set; }

        [Parameter(DefaultValue = true)]
        public bool Buy { get; set; }

        [Parameter(DefaultValue = 10)]
        public double TakeProfitPips { get; set; }

        [Parameter(DefaultValue = 10)]
        public double StopLossPips { get; set; }

        protected string MyLabel
        {
            get { return string.Format("{0} {1} {2}", RobotLabel, Symbol.Code, TimeFrame); }
        }

        protected TradeType TradeType
        {
            get { return Buy ? TradeType.Buy : TradeType.Sell; }
        }

        protected override void OnStart()
        {
            double targetPrice = TradeType == TradeType.Buy ? Symbol.Ask + Target * Symbol.PipSize : Symbol.Bid - Target * Symbol.PipSize;

            PlaceStopOrder(TradeType, Symbol, Volume, targetPrice, MyLabel, StopLossPips, TakeProfitPips);

        }

        protected override void OnTick()
        {

        }
    }
}

Hi All

I need help with code i wish to use cbot more like tool i used yours reference  code for limit orders and changed it to stop orders

but i want cbot to create stop orders like grid so if i set target for example 10 pips i want stop orders to be created every 10 pips

from current price and if possible maximum stoporders amount  setting will be nice

thx

Raf 

 


@rcc25
Replies

Spotware
17 Jun 2015, 18:01

Dear Trader,

We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.


@Spotware