Use Panel to update BOT parameters/variables
Use Panel to update BOT parameters/variables
11 Nov 2020, 12:55
Hi,
I have a small on screen panel that I want to use to update the main BOT parameters.
This shows the BOT parameters
This is the on-screen panel
private void ApplyAll()
{
var MaxSell = GetValueFromInput(SELLInputKey, 0);
var MaxBuy= GetValueFromInput(BUYInputKey, 0);
_robot.Print(string.Format("Update Parameters: Max SELL positions: {0}, Max BUY positions: {1}", MaxSell, MaxBuy));
// Need to update BOT Parameters or variables here
}
This is the code I'm using when the Apply Changes button is clicked. It works and write the values in to the log but whatever I try I can't get it to update the "main" BOT variables.....
The panel is defined as - public class ParameterPanel : CustomControl and that is within public class TSGridBETA : Robot
Any help would be appreciated !
Lisa
Replies
lisabeaney
11 Nov 2020, 14:26
RE:
PanagiotisCharalampous said:
Hi Lisa,
The parameter values displayed in the cBot parameters panel are not updated if they are changed from within the code.
Best Regards,
Panagiotis
Hi Panagiotis,
What I'm trying to do is set a variable based initially on the BOT parameter but then updated from the field in the Panel....
ie. take this parameter
[Parameter("Max Buy Positions", Group = "Open Positions", DefaultValue = 8, MinValue = 0)]
public double MaxOpenBuy { get; set; }
public double iMaxBuy, iMaxSell;
Then, when the BOT starts :
protected override void OnStart()
{
iMaxBuy = MaxOpenBuy
}
and then have the iMaxBuy variable updated by the MaxBuy when the user clicks on the "Apply Changes" button.
I know its most probably a really simple thing I'm getting wrong or I've missed but I can't seem to get the iMaxBuy to update !
Many thanks,
Lisa
@lisabeaney
PanagiotisCharalampous
11 Nov 2020, 14:37
Hi Lisa,
In order to help you further, you need to provide me with the complete cBot code.
Best Regards,
Panagiotis
@PanagiotisCharalampous
lisabeaney
11 Nov 2020, 14:44
RE:
PanagiotisCharalampous said:
Hi Lisa,
In order to help you further, you need to provide me with the complete cBot code.
Best Regards,
Panagiotis
No problem, I'll email it through to you :)
@lisabeaney
PanagiotisCharalampous
11 Nov 2020, 13:51
Hi Lisa,
The parameter values displayed in the cBot parameters panel are not updated if they are changed from within the code.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous