Topics
Replies
winsonet
18 Feb 2023, 14:23
( Updated at: 21 Dec 2023, 09:23 )
RE:
it's need to use the below for .Net 6
Process.Start( new ProcessStartInfo { FileName = @"http://. . . .", UseShellExecute = true } );
Process.Start( new ProcessStartInfo { FileName = @"C:\", UseShellExecute = true } );
medvedilich said:
protected override void OnStart()
{
var program = new Process {
StartInfo = {
FileName = "python.exe",
WorkingDirectory = @"C:\Users\alan\AppData\Local\Spotware\cTrader\4a28ae902aa17e9068eea37241a33c59\app_4.2.22.8450",
Arguments = "d:/программирование/python/test.py"
}
};
program.Start();}
When I run this code, there is a message in the log: 'Crashed in OnStart with Win32Exception: An error occurred trying to start process 'python.exe' with working directory 'C:\Users\alan\AppData\Local\Spotware\cTrader\4a28ae902aa17e9068eea37241a33c59\app_4.2.22.8450'. Unknown error (0x2)'
However, it works in Visual Studio in console app, and python file executes.
@winsonet
winsonet
18 Feb 2023, 14:21
RE: RE:
I think this is my OS issue, after re-install the windows and the problem has been fixed, thanks!
winsonet said:
sure, actually, I just created a new cBot in my cTrader and didn't change anything and just not working :(
I can show you the source code, but how can I send it to you? I can't upload in here.
and I still did not fix this issue
Thanks!
PanagiotisChar said:
If you can share the complete cBot code, I can check what it does on my computer
@winsonet
winsonet
13 Feb 2023, 17:06
RE:
sure, actually, I just created a new cBot in my cTrader and didn't change anything and just not working :(
I can show you the source code, but how can I send it to you? I can't upload in here.
and I still did not fix this issue
Thanks!
PanagiotisChar said:
If you can share the complete cBot code, I can check what it does on my computer
@winsonet
winsonet
13 Feb 2023, 16:41
RE:
Yes, of course I did!
PanagiotisChar said:
Hi there,
Make sure you have set the access rights to FullAccess.
Need help? Join us on Telegram
Need premium support? Trade with us
@winsonet
winsonet
11 Feb 2023, 03:33
( Updated at: 21 Dec 2023, 09:23 )
RE:
I still can't resolve the problem, but I found that can build with VS without source code by default, that's enough, this is what I want, thanks!
Spotware said:
Dear trader,
Unfortunately we were not able to reproduce your problem. If you want to include sources when building from VS, then you can add the following tag in .csproj
<IncludeSource>True</IncludeSource>
Best regards,
cTrader Team
@winsonet
winsonet
19 Mar 2021, 14:21
RE: RE:
WienAT said:
winsonet said:
I don't know what's the problems of your case, if you want to change the background color, just set it's color should be ok:
Overall1.BackgroundColor = Color.Red;
but I don't know when and where will you want to check the variable for do this?
I will try like you suggested.
I have one textbox where some text is presented (let say that also value of currenct profit is shown).
if profit is more then 0, then i would like to have green background ... if profit is less then 0, then i would like to have red background ...
If i understood you correctly, i should od like this:
if (profit > 0) Overall1.BackgroundColor = Color.Green; else Overall1.BackgroundColor = Color.Red;
Yes, and if you want to base on current profit to dynamic to change it, you can put the codes in
public override void Calculate(int index)
{
//your logic for calculate the profit
//update the background color
}
@winsonet
winsonet
18 Mar 2021, 08:47
RE: RE: RE: RE: Range bars completion thresholds for the current bar plus bar size information.
Oh, actually, I didn't use that, I think you can try to search the indicator with google site search, you will find many similar indicators :)
site:https://ctrader.com/algos/indicators range bars
@winsonet
winsonet
17 Mar 2021, 16:13
RE: Range bars completion thresholds for the current bar plus bar size information.
quantictrader said:
Hello,
I hope i am writing on the right section. I´d like to ask if anyone have an indicator that displays the High and Low thresholds for the current bar plus bar size information.
Thanks in advance.
Regards
I think you can try this:
@winsonet
winsonet
17 Mar 2021, 15:54
RE:
jasonwm372 said:
Hey guys,
Can anyone suggest a good auto position size bot for me? Im a scaler on the 1M so I need a bot that shows the TP and SL and will calculate the lot size based on 1% of the account. Im having trouble finding some as I am new to Ctrader and getting used to it all, so if anyone uses any or knows a good one, it would be much appreciated!
Thanks!
you can also take a look another version of mine :)
@winsonet
winsonet
29 Jan 2021, 10:54
RE: RE: RE: RE: RE: RE: RE: RE: RE: RE:
dinhvuongfx said:
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
You don't create the new tradingPanel every time on tick, you need to put the trading Panel in a global and use it on tick:
TradingPanel tradingPanel; //define as global variable
protected override void OnStart()
{
//just need to create once time on start
tradingPanel = new TradingPanel(this, Symbol, DefaultLots, DefaultStopLossPips, DefaultTakeProfitPips);
}
protected override void OnTick()
{
//call the get value on tick
var sl = tradingPanel.GetValueFromInput("SLKey", 0);
Print("SL: " +sl);
}
@winsonet
winsonet
29 Jan 2021, 09:05
( Updated at: 29 Jan 2021, 09:07 )
RE: RE: RE: RE: RE: RE: RE: RE:
dinhvuongfx said:
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
easy, you just make it public and shoiuld be ok :)
for example , change below
private double GetValueFromInput(string inputKey, double defaultValue)
to
public double GetValueFromInput(string inputKey, double defaultValue)
and you will can use it as below:
tradingPanel.GetValueFromInput("name");
@winsonet
winsonet
29 Jan 2021, 08:54
( Updated at: 15 Jan 2024, 14:51 )
RE: RE: RE: RE:
dinhvuongfx said:
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!
this sample there is a little complicated for beginner, it created a custom control object and encapsulated the textbox control in it, if you just want to create a simple panel and get the value, you can take a look my Information Pad indicator and the description in here:
my indicator:
@winsonet
winsonet
29 Jan 2021, 08:38
RE: RE:
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
@winsonet
winsonet
10 Jan 2021, 12:05
RE:
firemyst said:
Well, you know how the $50.84 is calculated:
.0001 (pip size) * 8.2 pips (the SL) * 62000 (volume) == $50.84.
So reverse things:
.0001 * ((opening price - closing price) / pipsize) * x == $50.84.
Solve for x, which is the volume you seek.
:-)
Oh, thanks for your help!
@winsonet
winsonet
20 May 2024, 15:03
I also have the same issue, after I tried to invisible the elements (the Border in my case), it will still occupy the position and break my layout, hope can fix it ASAP, thanks!
@winsonet