Topics
Replies
dinhvuongfx
29 Jan 2021, 11:14
RE: RE: RE: RE: RE: RE: RE: RE: RE: RE: RE:
@winsonet You are great. Thank you ❤
@dinhvuongfx
dinhvuongfx
29 Jan 2021, 10:16
RE: RE: RE: RE: RE: RE: RE: RE: RE:
protected override void OnTick()
{
var tradingPanel = new TradingPanel(this, Symbol, defaultRR, DefaultStopLossPips);
double stopLossPips = tradingPanel.GetValueFromInput("SLKey", 0);
Chart.DrawStaticText("SL", stopLossPips.ToString(), VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
}
Thank you. But I got only the default SL, I cannot get the SL value whenever I change the SL in Textbox
@dinhvuongfx
dinhvuongfx
29 Jan 2021, 09:04
RE: RE: RE: RE: RE: RE: RE:
winsonet said:
oh, if you really want to get the value in the sample, there is a method GetValueFromInput for do that:
var lots = GetValueFromInput(LotsInputKey, 0);
this code from the sample, the LotsInputKey is the TextBox object name
"GetValueFromInput" is in TradingPanel class, not in main Class so I cannot get the value from panel
@dinhvuongfx
dinhvuongfx
29 Jan 2021, 09:01
RE: RE: RE: RE: RE: RE:
winsonet said:
But I did't say how to add the TextBox control, but if you know how to add the label into the panel, you should know how to do with the TextBox, it's same :)
Thank you for your resources. I do appreciate your help.
@dinhvuongfx
dinhvuongfx
29 Jan 2021, 08:43
RE: RE: RE:
winsonet said:
dinhvuongfx said:
winsonet said:
the value will save in a TextBox control, you can get the value with the TextBox Text attribute, for example:
the textbox control name is : tbSL, then you can get the value as below:
tbSL.Text
I added 2 functions in class "SampleTradingPanel"
private readonly IDictionary<string, TextBox> _inputMap = new Dictionary<string, TextBox>(); protected override void OnTick() { var stopLossPips = GetValueFromInput("SLKey", 0); Chart.DrawStaticText("SL", stopLossPips.ToString(), VerticalAlignment.Top, HorizontalAlignment.Right, Color.White); } private double GetValueFromInput(string inputKey, double defaultValue) { double value; return double.TryParse(_inputMap[inputKey].Text, out value) ? value : defaultValue; }
I got an error: "Crashed in OnTick with KeyNotFoundException: The given key was not present in the dictionary."
why you need to use _inputMap for save the textbox? also, if you want to do that, you need to add the textbox object in your dict at first
I don't have much C# textbox experience. Could you please check "Sample Trading Panel" cBot and print Stop Loss (pips) from Panel to the cTrader screen whenever tick changes and give me all the code?
Thank you so much!
@dinhvuongfx
dinhvuongfx
29 Jan 2021, 08:32
( Updated at: 29 Jan 2021, 08:33 )
RE:
winsonet said:
the value will save in a TextBox control, you can get the value with the TextBox Text attribute, for example:
the textbox control name is : tbSL, then you can get the value as below:
tbSL.Text
I added 2 functions in class "SampleTradingPanel"
private readonly IDictionary<string, TextBox> _inputMap = new Dictionary<string, TextBox>();
protected override void OnTick()
{
var stopLossPips = GetValueFromInput("SLKey", 0);
Chart.DrawStaticText("SL", stopLossPips.ToString(), VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
}
private double GetValueFromInput(string inputKey, double defaultValue)
{
double value;
return double.TryParse(_inputMap[inputKey].Text, out value) ? value : defaultValue;
}
I got an error: "Crashed in OnTick with KeyNotFoundException: The given key was not present in the dictionary."
@dinhvuongfx
dinhvuongfx
10 Dec 2019, 12:09
RE:
redblue said:
Could you make the active chart tab colour more distinctive (currency chart tabs at top) or even better allow different customised colours for each chart tab?
This would be really helpful
Thank you
+1
@dinhvuongfx
dinhvuongfx
13 Jul 2021, 18:27
RE:
+1
@dinhvuongfx