Replies

BlackTiger83
26 Aug 2024, 11:45

Why would you want that? Simply start a new test with new parameters :)


@BlackTiger83

BlackTiger83
23 Aug 2024, 06:57 ( Updated at: 23 Aug 2024, 13:17 )

RE: Renko - cBot dont get all Bars

PanagiotisCharalampous said: 

Hi there,

I can see 11180. Can you check again?

Best regards,

Panagiotis

You are totally right, sorry. But I had this in several places. See here: 
I thought the “OnBar()” or “OnBarClosed()” gets every bar?
NAS 100 RE10

 

Code:

using cAlgo.API;
using cAlgo.API.Internals;
using System;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SimpleRenkoColorNumber : Robot
    {
        private int previousIndex = -1; 
        protected override void OnBarClosed()
        {
            int index = Bars.Count - 1;

            // Überprüfen, ob der aktuelle Index genau um 1 größer ist als der vorherige
            if (previousIndex >= 0 && index != previousIndex + 1)
            {
                DrawWarningLine(Bars.OpenTimes[index]);
            }

            Chart.DrawText("BarNumber" + index, (index + 1).ToString(), Bars.OpenTimes[index], Bars.HighPrices[index] + Symbol.PipSize * 5, Color.White);

            Print("Bar closed: " + index);


            previousIndex = index;
        }

        private void DrawWarningLine(DateTime time)
        {
            string lineName = "WarningLine_" + time.ToString("yyyyMMddHHmmss");
            Chart.DrawVerticalLine(lineName, time, Color.Yellow, 2, LineStyle.Solid);
        }
    }
}

@BlackTiger83