<commit_before>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using AgenaTrader.API;
using AgenaTrader.Custom;
using AgenaTrader.Plugins;
using AgenaTrader.Helper;

/// <summary>
/// Version: 1.0
/// -------------------------------------------------------------------------
/// <NAME> 2016
/// -------------------------------------------------------------------------
/// Description http://lindaraschke.net/wp-content/uploads/2013/11/august1997.pdf
/// -------------------------------------------------------------------------
/// ****** Important ******
/// To compile this script without any error you also need access to the utility indicator to use global source code elements.
/// You will find this script on GitHub: https://github.com/simonpucher/AgenaTrader/blob/master/Utility/GlobalUtilities_Utility.cs
/// -------------------------------------------------------------------------
/// Namespace holds all indicators and is required. Do not change it.
/// </summary>
namespace AgenaTrader.UserCode
{
    [Description("Watch out for the lonely warrior behind enemy lines.")]
    public class Holy_Grail_Indicator : UserIndicator
    {

        //input
        private bool _showarrows = true;
        private Color _plot0color = Const.DefaultIndicatorColor;
        private int _plot0width = Const.DefaultLineWidth;
        private DashStyle _plot0dashstyle = Const.DefaultIndicatorDashStyle;
        private Color _plot1color = Const.DefaultIndicatorColor_GreyedOut;
        private int _plot1width = Const.DefaultLineWidth;
        private DashStyle _plot1dashstyle = Const.DefaultIndicatorDashStyle;


        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            Add(new Plot(new Pen(this.Plot0Color, this.Plot0Width), PlotStyle.Line, "Plot_Line1"));
            Add(new Plot(new Pen(this.Plot1Color, this.Plot1Width), PlotStyle.Line, "Plot_Line2"));
            Add(new Plot(new Pen(this.Plot0Color, this.Plot0Width), PlotStyle.Line, "Plot_Line3"));

            CalculateOnBarClose = true;
            Overlay = false;
            AutoScale = true;

            //Because of Backtesting reasons if we use the advanced mode we need at least two bars
            this.BarsRequired = 20;
        }

   

        protected override void OnBarUpdate()
        {

      

            ADX adx = ADX(14);
            EMA ema = EMA(20);

            double singnaldata = 0;


            if (adx[0] > 30 && adx[0] > adx[1] && Input[0] <= ema[0])
            {
                singnaldata = 1;
                DrawArrowUp("ArrowLong_Entry" + +Bars[0].Time.Ticks, this.AutoScale, 0, Bars[0].Low, Color.Green);
            }


            SignalLine.Set(singnaldata);
            PlotLine_ADX.Set(adx[0]);
            PlotLine_XMA.Set(ema[0]);



            PlotColors[0][0] = this.Plot0Color;
            Plots[0].PenStyle = this.Dash0Style;
            Plots[0].Pen.Width = this.Plot0Width;

            PlotColors[1][0] = this.Plot1Color;
            Plots[1].PenStyle = this.Dash1Style;
            Plots[1].Pen.Width = this.Plot1Width;

            PlotColors[2][0] = this.Plot1Color;
            Plots[2].PenStyle = this.Dash1Style;
            Plots[2].Pen.Width = this.Plot1Width;

        }


        public override string ToString()
        {
            return "Holy Grail (I)";
        }
<commit_msg>modified version of the holy grail<commit_after>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using AgenaTrader.API;
using AgenaTrader.Custom;
using AgenaTrader.Plugins;
using AgenaTrader.Helper;

/// <summary>
/// Version: 1.1
/// -------------------------------------------------------------------------
/// <NAME> 2016
/// -------------------------------------------------------------------------
/// Description http://lindaraschke.net/wp-content/uploads/2013/11/august1997.pdf
/// -------------------------------------------------------------------------
/// ****** Important ******
/// To compile this script without any error you also need access to the utility indicator to use global source code elements.
/// You will find this script on GitHub: https://github.com/simonpucher/AgenaTrader/blob/master/Utility/GlobalUtilities_Utility.cs
/// -------------------------------------------------------------------------
/// Namespace holds all indicators and is required. Do not change it.
/// </summary>
namespace AgenaTrader.UserCode
{
    [Description("Watch out for the lonely warrior behind enemy lines.")]
    public class Holy_Grail_Indicator : UserIndicator
    {

        //input
        private bool _showarrows = true;
        private Color _plot0color = Const.DefaultIndicatorColor;
        private int _plot0width = Const.DefaultLineWidth;
        private DashStyle _plot0dashstyle = Const.DefaultIndicatorDashStyle;
        private Color _plot1color = Const.DefaultIndicatorColor_GreyedOut;
        private int _plot1width = Const.DefaultLineWidth;
        private DashStyle _plot1dashstyle = Const.DefaultIndicatorDashStyle;


        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            Add(new Plot(new Pen(this.Plot0Color, this.Plot0Width), PlotStyle.Line, "Plot_Line1"));
            Add(new Plot(new Pen(this.Plot1Color, this.Plot1Width), PlotStyle.Line, "Plot_Line2"));
            Add(new Plot(new Pen(this.Plot0Color, this.Plot0Width), PlotStyle.Line, "Plot_Line3"));

            CalculateOnBarClose = true;
            Overlay = false;
            AutoScale = true;

            //Because of Backtesting reasons if we use the advanced mode we need at least two bars
            this.BarsRequired = 20;
        }

   

        protected override void OnBarUpdate()
        {

            ADX adx = ADX(14);
            EMA ema = EMA(20);
            RSI rsi = RSI(14, 3);

            double singnaldata = 0;


            if (adx[0] > 30 && adx[0] > adx[1] && Input[0] <= ema[0])
            {
                Color color = Color.Green;
                if (rsi[0] <= 30)
                {
                    color = Color.LightGreen;
                    singnaldata = 1;
                }
                else
                {
                    singnaldata = 0.5;
                }
                DrawArrowUp("ArrowLong_Entry" + +Bars[0].Time.Ticks, this.AutoScale, 0, Bars[0].Low, color);
            }

            //ADX adx = ADX(14);
            //EMA ema = EMA(20);

            //double singnaldata = 0;


            //if (adx[0] > 30 && adx[0] > adx[1] && Input[0] <= ema[0])
            //{
            //    singnaldata = 1;
            //    DrawArrowUp("ArrowLong_Entry" + +Bars[0].Time.Ticks, this.AutoScale, 0, Bars[0].Low, Color.Green);
            //}


            SignalLine.Set(singnaldata);
            PlotLine_ADX.Set(adx[0]);
            PlotLine_XMA.Set(ema[0]);



            PlotColors[0][0] = this.Plot0Color;
            Plots[0].PenStyle = this.Dash0Style;
            Plots[0].Pen.Width = this.Plot0Width;

            PlotColors[1][0] = this.Plot1Color;
            Plots[1].PenStyle = this.Dash1Style;
            Plots[1].Pen.Width = this.Plot1Width;

            PlotColors[2][0] = this.Plot1Color;
            Plots[2].PenStyle = this.Dash1Style;
            Plots[2].Pen.Width = this.Plot1Width;

        }


        public override string ToString()
        {
            return "Holy Grail (I)";
        }

{'fraction_non_alphanumeric': 0.1778591264832113, 'fraction_numerical': 0.02145922746781116, 'mean_word_length': 1.6903225806451614, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2115366', 'n_tokens_mistral': 2312, 'n_tokens_neox': 2173, 'n_words': 524}