Replies

jjwes76@gmail.com
22 Mar 2018, 10:58

Error CS0103: The name 'position' does not exist in the current context

How do i fix this


@jjwes76@gmail.com

jjwes76@gmail.com
22 Mar 2018, 10:31

EntryPrice will be the open position can i add a lable or volume to code


@jjwes76@gmail.com

jjwes76@gmail.com
22 Mar 2018, 10:31

EntryPrice will be the open position can i add a lable or volume to code


@jjwes76@gmail.com

jjwes76@gmail.com
22 Mar 2018, 10:31

EntryPrice will be the open position can i add a lable or volume to code


@jjwes76@gmail.com

jjwes76@gmail.com
21 Mar 2018, 21:42

when the sma cross above a opensell position how do i open a nother buy position


@jjwes76@gmail.com

jjwes76@gmail.com
11 Mar 2018, 17:08

thanks for your help Panagiotis i got the cbot to work


@jjwes76@gmail.com

jjwes76@gmail.com
09 Mar 2018, 12:28

Conditions to open a buy position

1) Rsi must be oversold

2) 100 SMA  must be under the 500 EMA

3) if a buy position is opened the cbot can open another position if  NO 1 and NO 2 are met and the first position is not in profit

i do not want the cbot to open a trade if one of my trades is in profit

is this a good explination


@jjwes76@gmail.com

jjwes76@gmail.com
09 Mar 2018, 12:08

I have two cbots running with this one protecting me from blowing my acc if all the conditions are met the cbot can open as meny trade as it wants 

 


@jjwes76@gmail.com

jjwes76@gmail.com
09 Mar 2018, 10:36

RE:

Panagiotis Charalampous said:

Hi jjwes76@gmail.com,

You can use the NetProfit property of the opened position to check if is profitable. If you most your cBot code, I might be able to modify it accordingly for you.

Best Regards,

Panagiotis

{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BuyBot : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Periods", DefaultValue = 20)]
        public int Periods { get; set; }

        [Parameter("Instance Name", DefaultValue = "SampleRSI")]
        public string InstanceName { get; set; }

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


        [Parameter("Source SMA #1")]
        public DataSeries SourceSma1 { get; set; }

        [Parameter("Period SMA #1", DefaultValue = 150)]
        public int PeriodsSma1 { get; set; }







        [Parameter("Source EMA #1")]
        public DataSeries SourceEma1 { get; set; }

        [Parameter("MAType EMA #1", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MaType { get; set; }

        [Parameter("Period EMA #1", DefaultValue = 5000)]
        public int PeriodsEma1 { get; set; }



        [Parameter("RSI BUY", DefaultValue = 20)]
        public int RsiBuy { get; set; }


        private RelativeStrengthIndex rsi { get; set; }
        private SimpleMovingAverage _sma1 { get; set; }
        private ExponentialMovingAverage _emaSlow { get; set; }


        protected override void OnStart()
        {

            _sma1 = Indicators.SimpleMovingAverage(SourceSma1, PeriodsSma1);
            rsi = Indicators.RelativeStrengthIndex(Source, Periods);
            _emaSlow = Indicators.ExponentialMovingAverage(SourceEma1, PeriodsEma1);

        }

        protected override void OnBar()
        {
            if (rsi.Result.LastValue < RsiBuy)


                if (_sma1.Result.LastValue < _emaSlow.Result.LastValue)
                {
                    ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "Instance Name", nullnull);
                    {
                    }
                }
        }
    }

}

The cbot can open positions if the price is higher on open buy positions but not lower on the open buy positions

and lower on sell positions but not higher

I want the cbot to open a trade evry minute  if those conditions are met i do have a cbot that will stop the trades if the market turn against me

thank you


@jjwes76@gmail.com