Showing a Window in cAlgo ? "WindForm"
Showing a Window in cAlgo ? "WindForm"
27 Sep 2015, 03:27
Basically I want to make a scanner and showing the results in a window
i.e Scan instruments for criteria x,y,z and if they are met , what is the pair and at what time frame etc
is there any way to make something like
Form myform = new System.Windows.Forms in cAlgo ?
Replies
cyfer
29 Sep 2015, 07:12
That's what i did before posting the question but I always get this exception
29/09/2015 06:09:19.482 | Crashed in Initialize with SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
@cyfer
ClickAlgo
29 Sep 2015, 11:09
( Updated at: 21 Dec 2023, 09:20 )
I forgot to mention, you do not need to write the GUI (presentation) code, just create your form with the controls and open the Form.Designer.cs file and copy and paste into your Indicator, you can can then create nice and clean complex forms in a very short time.
@ClickAlgo
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
dordkash@gmail.com
22 Mar 2020, 22:05
( Updated at: 21 Dec 2023, 09:21 )
RE:
ClickAlgo said:
I forgot to mention, you do not need to write the GUI (presentation) code, just create your form with the controls and open the Form.Designer.cs file and copy and paste into your Indicator, you can can then create nice and clean complex forms in a very short time.
HI
TextBoxes dont work
Please correct it
It can be very useful
Thankful
@dordkash@gmail.com
PanagiotisCharalampous
23 Mar 2020, 09:17
( Updated at: 21 Dec 2023, 09:21 )
RE: RE:
dordkash@gmail.com said:
ClickAlgo said:
I forgot to mention, you do not need to write the GUI (presentation) code, just create your form with the controls and open the Form.Designer.cs file and copy and paste into your Indicator, you can can then create nice and clean complex forms in a very short time.
HI
TextBoxes dont work
Please correct it
It can be very useful
Thankful
Hi,
Can you explain what do you mean?
Best Regards,
Panagiotis
@PanagiotisCharalampous
dordkash@gmail.com
23 Mar 2020, 10:05
( Updated at: 21 Dec 2023, 09:21 )
RE: RE: RE:
PanagiotisCharalampous said:
dordkash@gmail.com said:
ClickAlgo said:
I forgot to mention, you do not need to write the GUI (presentation) code, just create your form with the controls and open the Form.Designer.cs file and copy and paste into your Indicator, you can can then create nice and clean complex forms in a very short time.
HI
TextBoxes dont work
Please correct it
It can be very useful
ThankfulHi,
Can you explain what do you mean?
Best Regards,
Panagiotis
Yes
When this code goes into VS and the form is added to it, it gets a few errors when Build
@dordkash@gmail.com
mrha1000
25 Mar 2020, 08:01
( Updated at: 21 Dec 2023, 09:21 )
RE:
ClickAlgo said:
I forgot to mention, you do not need to write the GUI (presentation) code, just create your form with the controls and open the Form.Designer.cs file and copy and paste into your Indicator, you can can then create nice and clean complex forms in a very short time.
TexBox and Bottun have a problem
It's a pity
@mrha1000
Spotware
28 Sep 2015, 19:44 ( Updated at: 21 Dec 2023, 09:20 )
Dear Trader,
You need to reference the Windows.Forms library in order to be able to use it.
To reference a .NET Framework library, please perform the following steps.
Click on the “Manage References” button.
Select the .NET Framework field and then the library you would like to reference and click the Apply button.
As last step you add the using directive in your code.
Afterwards you will be able to call methods/objects provided by the library you referenced.
@Spotware