Renko Robot not working

Created at 25 May 2020, 01:17
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!
CG

cgatting

Joined 25.05.2020

Renko Robot not working
25 May 2020, 01:17


I have coded this my self and have been trying to get it to work for weeks no however I am unable to

Used only on renko charts normally Re10 on GBPUSD and for what ever reason doesn't work if anybody could post suggestions / fixes I would really apreiciate it 

 

 

using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System;
using System.Collections.Generic;
using System.Linq;


namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RenkoScalping : Robot
    {
        [Parameter("Stop Loss Pips", DefaultValue = 0, Step = 1)]
        public int SL { get; set; }

        [Parameter("Risk per position", DefaultValue = 1, MinValue = 0.01)]
        public double Position_Risk { get; set; }

        private List<string> renkos = new List<string>();


        protected override void OnBar()
        {
            var lotsize = (Account.Balance + Position_Risk / 100) / (SL * Symbol.PipValue);
            double close = Bars.LastBar.Close;
            double open = Bars.LastBar.Open;
            var colour = open > close ? ("Red") : ("Green");
            renkos.Add(colour);
            if ((renkos[0] == renkos[1]) & (renkos[1] == ("Green")))
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol.Name, lotsize, "Order 001", SL, null);
            }
            else
            {
                ExecuteMarketOrder(TradeType.Sell, Symbol.Name, lotsize, "Order 001", SL, null);
            }
            if (Positions.Count() > 1)
            {
                double stoploss = Bars.LastBar.Close;
                foreach (var position in Positions)
                    ModifyPosition(position, stoploss);
            }



            string renkos_data = "Lists: " + renkos[0];
            ChartObjects.DrawText("Sample Text", renkos_data, StaticPosition.TopRight, Colors.White);

            bool text = Symbol.MarketHours.IsOpened(Time.Date);
            if (text.Equals(false))
            {
                foreach (var position in Positions)
                    position.Close();
                renkos.Clear();
            }
        }
    }
}


@cgatting
Replies

PanagiotisCharalampous
25 May 2020, 08:51

Hi cgatting,

You will need to provide more information of you want somebody to help you like

  1. What is the cBot suppose to do?
  2. What is it doing instead?
  3. What would you expect the fix to change?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

cgatting
25 May 2020, 17:40

RE:

PanagiotisCharalampous said:

Hi cgatting,

You will need to provide more information of you want somebody to help you like

  1. What is the cBot suppose to do?
  2. What is it doing instead?
  3. What would you expect the fix to change?

Best Regards,

Panagiotis 

Join us on Telegram

 

My Cbot is meant to bit a renko scalping EA. Basiclaly if two candles are the same colour then buy or sell when appropiate, either bullish or bearish. Then repeat this for each candle on the trend, buying x amount of lots for each candle on the trend, when to candles of the oppisite colour come onto the chart cashout. SL is meant to be set box size * 2 pips above and SL for each open trade moves to the closing price of the previous candle.

Instead after two candles of the same colour my EA Stops running and "pauses" / stops running.

 


@cgatting

cgatting
25 May 2020, 17:42

RE: RE:

cgatting said:

PanagiotisCharalampous said:

Hi cgatting,

You will need to provide more information of you want somebody to help you like

  1. What is the cBot suppose to do?
  2. What is it doing instead?
  3. What would you expect the fix to change?

Best Regards,

Panagiotis 

Join us on Telegram

 

My Cbot is meant to bit a renko scalping EA. Basiclaly if two candles are the same colour then buy or sell when appropiate, either bullish or bearish. Then repeat this for each candle on the trend, buying x amount of lots for each candle on the trend, when to candles of the oppisite colour come onto the chart cashout. SL is meant to be set box size * 2 pips above and SL for each open trade moves to the closing price of the previous candle.

Instead after two candles of the same colour my EA Stops running and "pauses" / stops running.

I believe looking over it that the error might be with the list and calling the list back to check bool values of if (renko[0] == renko[1])

 

 


@cgatting