Output variable value to textbox

Created at 23 Aug 2021, 21:40
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
WA

waym77

Joined 22.07.2021

Output variable value to textbox
23 Aug 2021, 21:40


Hi all,

I spent some time attempting to figure all of this out on my own, but no luck so far.

I've added some code snippets for reference, as the source for this bot has gotten kind of long so far.

The basic problem: to output the value of a variable to a textbox (chart object).

The code has an existing method of retrieving the value of a textbox and assigning it to a variable. That method looks like this:
 

private double GetValueFromInput(string inputKey, double defaultValue)
        {
            double value;

            return double.TryParse(_inputMap[inputKey].Text, out value) ? value : defaultValue;
        }


An example of using the above method looks like this:

var _lots = GetValueFromInput(LotsInputKey, 0);

In the above example, LotsInputKey is the assigned variable of the textbox.

 

What I am looking for is basically the exact opposite of this; a way to set the value of a textbox equal to a variable.

I am not even entirely sure if a method would be the best way to accomplish this, which is why I'm asking

Any advice would be greatly appreciated, thanks.


@waym77
Replies

artcfd
07 Sep 2021, 14:55

RE: Please post more ideas up later, we really like your thinking, thanks. I was running around forwarding you that trading panel and eventually it was solved.

waym77 said:

Hi all,

I spent some time attempting to figure all of this out on my own, but no luck so far.

I've added some code snippets for reference, as the source for this bot has gotten kind of long so far.

The basic problem: to output the value of a variable to a textbox (chart object).

The code has an existing method of retrieving the value of a textbox and assigning it to a variable. That method looks like this:
 

private double GetValueFromInput(string inputKey, double defaultValue)
        {
            double value;

            return double.TryParse(_inputMap[inputKey].Text, out value) ? value : defaultValue;
        }


An example of using the above method looks like this:

var _lots = GetValueFromInput(LotsInputKey, 0);

In the above example, LotsInputKey is the assigned variable of the textbox.

 

What I am looking for is basically the exact opposite of this; a way to set the value of a textbox equal to a variable.

I am not even entirely sure if a method would be the best way to accomplish this, which is why I'm asking

Any advice would be greatly appreciated, thanks.

 


@artcfd

artcfd
08 Sep 2021, 11:26

Some suggestions.

Hi blogger, is it possible to change the limit in the panel to the kind of drag and drop that comes with the system? Instead of entering the price of the limit manually, the input is not as convenient as the direct drag and drop. Because it already has fragmentation and stop loss function.


@artcfd