Replies

eivaremir
26 Oct 2019, 23:26

RE:

Panagiotis Charalampous said:

Hi tmfd,

The plan is for v3.7.

Best Regards,

Panagiotis

PLEASE


@eivaremir

eivaremir
22 Sep 2019, 01:50

RE:

TextBoxes dont work

ClickAlgo said:

Use this as a template, the deal is you use Visual Studio to create a Windows Application, use the designer to create your forms:-

https://msdn.microsoft.com/en-us/library/dd492132.aspx

You need unlimited access that's why you may be getting the exception.

Try not to use the threading unless you know what you are doing, it is just an example and not a working copy.

using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Collections;
using System.Linq;
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Threading;

namespace cAlgo
{
    [Indicator(IsOverlay = true)]
    public class SignalTrader : Indicator
    {
        [Parameter("Periods", DefaultValue = 14)]
        public int Periods { get; set; }

        private Form form;
        private GroupBox groupBox1;
        private StatusStrip statusStrip1;
        private MenuStrip menuStrip1;
        private ToolStripMenuItem settingsToolStripMenuItem;
        private ToolStripMenuItem cHARTSToolStripMenuItem;
        private ToolStripMenuItem aNALYSEToolStripMenuItem;
        private ToolStripMenuItem hELPToolStripMenuItem;
        private ComboBox comboBox6;
        private ComboBox comboBox5;
        private Label label3;
        private Label label2;
        private Label label1;
        private ComboBox comboBox4;
        private TextBox textBox2;
        private TextBox textBox1;
        private ComboBox comboBox3;
        private ComboBox comboBox2;
        private ComboBox comboBox1;
        private WebBrowser webBrowser1;
        private GroupBox groupBox2;
        private Button button1;
        private TextBox textBox4;
        private ToolStripStatusLabel toolStripStatusLabel2;
        private Label label4;
        private ComboBox comboBox7;
        private Button button2;

        // singleton
        private Thread thread;

        [STAThread()]
        protected override void Initialize()
        {
            thread = new Thread(new ThreadStart(WindowsApp));
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            thread.Join();
            while (thread.IsAlive)
                System.Windows.Forms.Application.DoEvents();
        }

        [STAThread()]
        private void WindowsApp()
        {
            form = new Form();

            InitializeComponent();

            form.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            form.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            form.ClientSize = new System.Drawing.Size(480, 814);
            form.Controls.Add(this.label4);
            form.Controls.Add(this.groupBox2);
            form.Controls.Add(this.webBrowser1);
            form.Controls.Add(this.statusStrip1);
            form.Controls.Add(this.menuStrip1);
            form.Controls.Add(this.groupBox1);
            form.MainMenuStrip = this.menuStrip1;
            form.Name = "Form1";
            form.Text = "Signal Trader";

            form.ResumeLayout(false);
            form.PerformLayout();

            Application.Run(form);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.webBrowser1 = null;
            this.form.Close();
            thread.Abort();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate("http://phayes-001-site5.smarterasp.net/AllTechnical.html");
        }

        public override void Calculate(int index)
        {
        }

        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.textBox4 = new System.Windows.Forms.TextBox();
            this.comboBox6 = new System.Windows.Forms.ComboBox();
            this.comboBox5 = new System.Windows.Forms.ComboBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.comboBox4 = new System.Windows.Forms.ComboBox();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.comboBox3 = new System.Windows.Forms.ComboBox();
            this.comboBox2 = new System.Windows.Forms.ComboBox();
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.statusStrip1 = new System.Windows.Forms.StatusStrip();
            this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.cHARTSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.aNALYSEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.hELPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.button2 = new System.Windows.Forms.Button();
            this.comboBox7 = new System.Windows.Forms.ComboBox();
            this.button1 = new System.Windows.Forms.Button();
            this.label4 = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.statusStrip1.SuspendLayout();
            this.menuStrip1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.textBox4);
            this.groupBox1.Controls.Add(this.comboBox6);
            this.groupBox1.Controls.Add(this.comboBox5);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.comboBox4);
            this.groupBox1.Controls.Add(this.textBox2);
            this.groupBox1.Controls.Add(this.textBox1);
            this.groupBox1.Controls.Add(this.comboBox3);
            this.groupBox1.Controls.Add(this.comboBox2);
            this.groupBox1.Controls.Add(this.comboBox1);
            this.groupBox1.Location = new System.Drawing.Point(12, 27);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(458, 152);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            // 
            // textBox4
            // 
            this.textBox4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.textBox4.ForeColor = System.Drawing.SystemColors.Window;
            this.textBox4.Location = new System.Drawing.Point(6, 115);
            this.textBox4.Name = "textBox4";
            this.textBox4.Size = new System.Drawing.Size(87, 20);
            this.textBox4.TabIndex = 12;
            this.textBox4.Text = "SELL";
            this.textBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // comboBox6
            // 
            this.comboBox6.FormattingEnabled = true;
            this.comboBox6.Location = new System.Drawing.Point(131, 115);
            this.comboBox6.Name = "comboBox6";
            this.comboBox6.Size = new System.Drawing.Size(146, 21);
            this.comboBox6.TabIndex = 11;
            this.comboBox6.Text = "Custom Indicator 3";
            // 
            // comboBox5
            // 
            this.comboBox5.FormattingEnabled = true;
            this.comboBox5.Location = new System.Drawing.Point(131, 74);
            this.comboBox5.Name = "comboBox5";
            this.comboBox5.Size = new System.Drawing.Size(146, 21);
            this.comboBox5.TabIndex = 10;
            this.comboBox5.Text = "Custom Indicator 2";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(368, 20);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(70, 13);
            this.label3.TabIndex = 9;
            this.label3.Text = "TIMEFRAME";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(128, 20);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(66, 13);
            this.label2.TabIndex = 8;
            this.label2.Text = "INDICATOR";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(7, 20);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(46, 13);
            this.label1.TabIndex = 7;
            this.label1.Text = "SIGNAL";
            // 
            // comboBox4
            // 
            this.comboBox4.FormattingEnabled = true;
            this.comboBox4.Items.AddRange(new object[] 
            {
                "Stochastic RSI"
            });
            this.comboBox4.Location = new System.Drawing.Point(131, 36);
            this.comboBox4.Name = "comboBox4";
            this.comboBox4.Size = new System.Drawing.Size(146, 21);
            this.comboBox4.TabIndex = 6;
            this.comboBox4.Text = "Custom Indicator 1";
            // 
            // textBox2
            // 
            this.textBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
            this.textBox2.ForeColor = System.Drawing.SystemColors.Window;
            this.textBox2.Location = new System.Drawing.Point(6, 75);
            this.textBox2.Name = "textBox2";
            this.textBox2.Size = new System.Drawing.Size(87, 20);
            this.textBox2.TabIndex = 4;
            this.textBox2.Text = "BUY";
            this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // textBox1
            // 
            this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.textBox1.ForeColor = System.Drawing.SystemColors.Window;
            this.textBox1.Location = new System.Drawing.Point(6, 36);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(87, 20);
            this.textBox1.TabIndex = 3;
            this.textBox1.Text = "SELL";
            this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // comboBox3
            // 
            this.comboBox3.FormattingEnabled = true;
            this.comboBox3.Location = new System.Drawing.Point(302, 36);
            this.comboBox3.Name = "comboBox3";
            this.comboBox3.Size = new System.Drawing.Size(146, 21);
            this.comboBox3.TabIndex = 2;
            this.comboBox3.Text = "15 Minutes";
            // 
            // comboBox2
            // 
            this.comboBox2.FormattingEnabled = true;
            this.comboBox2.Location = new System.Drawing.Point(302, 75);
            this.comboBox2.Name = "comboBox2";
            this.comboBox2.Size = new System.Drawing.Size(146, 21);
            this.comboBox2.TabIndex = 1;
            this.comboBox2.Text = "1 Hour";
            // 
            // comboBox1
            // 
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new System.Drawing.Point(302, 114);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(146, 21);
            this.comboBox1.TabIndex = 0;
            this.comboBox1.Text = "1 Hour";
            // 
            // statusStrip1
            // 
            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] 
            {
                this.toolStripStatusLabel2
            });
            this.statusStrip1.Location = new System.Drawing.Point(0, 792);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new System.Drawing.Size(480, 22);
            this.statusStrip1.TabIndex = 1;
            this.statusStrip1.Text = "statusStrip1";
            // 
            // toolStripStatusLabel2
            // 
            this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
            this.toolStripStatusLabel2.Size = new System.Drawing.Size(48, 17);
            this.toolStripStatusLabel2.Text = "Ready...";
            // 
            // menuStrip1
            // 
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] 
            {
                this.settingsToolStripMenuItem,
                this.cHARTSToolStripMenuItem,
                this.aNALYSEToolStripMenuItem,
                this.hELPToolStripMenuItem
            });
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new System.Drawing.Size(480, 24);
            this.menuStrip1.TabIndex = 2;
            this.menuStrip1.Text = "menuStrip1";
            // 
            // settingsToolStripMenuItem
            // 
            this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
            this.settingsToolStripMenuItem.Size = new System.Drawing.Size(12, 20);
            // 
            // cHARTSToolStripMenuItem
            // 
            this.cHARTSToolStripMenuItem.Name = "cHARTSToolStripMenuItem";
            this.cHARTSToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
            this.cHARTSToolStripMenuItem.Text = "Charts";
            // 
            // aNALYSEToolStripMenuItem
            // 
            this.aNALYSEToolStripMenuItem.Name = "aNALYSEToolStripMenuItem";
            this.aNALYSEToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
            this.aNALYSEToolStripMenuItem.Text = "Analyse";
            // 
            // hELPToolStripMenuItem
            // 
            this.hELPToolStripMenuItem.Name = "hELPToolStripMenuItem";
            this.hELPToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
            this.hELPToolStripMenuItem.Text = "Help";
            // 
            // webBrowser1
            // 
            this.webBrowser1.Location = new System.Drawing.Point(12, 212);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.ScrollBarsEnabled = false;
            this.webBrowser1.Size = new System.Drawing.Size(458, 502);
            this.webBrowser1.TabIndex = 5;
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.button2);
            this.groupBox2.Controls.Add(this.comboBox7);
            this.groupBox2.Controls.Add(this.button1);
            this.groupBox2.Location = new System.Drawing.Point(10, 720);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(450, 53);
            this.groupBox2.TabIndex = 4;
            this.groupBox2.TabStop = false;
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(162, 19);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 13;
            this.button2.Text = "&Retrieve";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // comboBox7
            // 
            this.comboBox7.FormattingEnabled = true;
            this.comboBox7.Items.AddRange(new object[] 
            {
                "Technical Analysis",
                "News Releases",
                "Momentum",
                "more..."
            });
            this.comboBox7.Location = new System.Drawing.Point(10, 19);
            this.comboBox7.Name = "comboBox7";
            this.comboBox7.Size = new System.Drawing.Size(146, 21);
            this.comboBox7.TabIndex = 12;
            this.comboBox7.Text = "Technical Analysis";
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(332, 19);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "&Exit";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(19, 193);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(119, 13);
            this.label4.TabIndex = 9;
            this.label4.Text = "FX Street Web Widgets";
            // 
            // Form1
            // 
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.groupBox2.ResumeLayout(false);


        }
    }
}

 

 


@eivaremir

eivaremir
11 Sep 2019, 17:57 ( Updated at: 21 Dec 2023, 09:21 )

I noticed this a day I backtested a bot which is tick sensitive. At every tick, desitions based on global P/L are made. For example: close trade if there's a 0.50 profit and open another again... or vice versa if its a loss then close and open another again. If there's a movement which changes my P/L to .40 then .55 then .45 there would exist a closed trade in profit and a trade opened. but if the data doesn't inlude the 2nd tick then the trade will still be open (.4->.45) the close trigger will never be executed. That's why ticks does affect the performance of the equity curve.

So i backtested it and i had an unusual result for just a period of time... This was somepoint between June 2015 and August 2015

So I did a similar procedure Cysecbin did... I exported the difference between the Ticks processed by the bot vs the MarketSeries.TickVolume to a .txt and i got interesting results...

Statistically the results are these, seems like all the time ticks processed are only the 80%-60% of the real ticks existed. The only moment the majority of real ticks were processed (90%-100%) happened during these 2 months at 2015, which reproduced almost 20k trades resulting in a huge profit for my algorithm, affecting the results dramatically... 

 

I would like to know how to respond to this situation...


@eivaremir

eivaremir
30 Jun 2019, 23:15

nope it's not possible


@eivaremir

eivaremir
09 Mar 2019, 15:12

Backtesting Options with custom timeframes

I've just written a bot which reads renko graphics, and I want to backtest it but this function isn't available, do you have plans to incorporate it in the future?


@eivaremir

eivaremir
08 Mar 2019, 19:41

RE:

afhacker said:

        public static Color GetColor(string colorString, int alpha = 255)
        {
            Color color = colorString[0] == '#' ? Color.FromHex(colorString) : Color.FromName(colorString);

            return Color.FromArgb(alpha, color);
        }

Thanks dude!

 


@eivaremir