Can you change FunctionPrameter values on the fly? I made a button to 'Disable trading' and when I click that it calls notrading() function in which im setting trade=false. This is a function parameter at the beginning of the script. It doesn't do anything. I keeps the parameter set to true. How can I change a parameter without having to go to the edit studies menu? Thx!! Happy monday.
Announcement
Collapse
No announcement yet.
FunctionPrameter values
Collapse
X
-
Re: FunctionPrameter values
Hello Geoff,
Originally posted by glay
Can you change FunctionPrameter values on the fly? I made a button to 'Disable trading' and when I click that it calls notrading() function in which im setting trade=false. This is a function parameter at the beginning of the script. It doesn't do anything. I keeps the parameter set to true. How can I change a parameter without having to go to the edit studies menu? Thx!! Happy monday.
Parameters that you want to control programmatically should be keept separate from Edit Studies parameters created with the FunctionParameter object. The closest you can get to having both ways is by passing the value of the FunctionParameter to a global variable, which I think is your boolean trade variable Your notrading() function would change the value of the global var and any conditional statements that need to check the state of this boolean value should be looking at the global var. However, keep in mind that once you change the value of the global var within notrading() and then you go back into Edit Studies, the value in Edit Studies cannot reflect the value that is stored by the global var. If you then click OK in Edit Studies, the global var will get set to the current value that appears in the Edit Studies window.Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
-
Ahh.. Wow. I'd of thought there'd of been an easier way to do this. I guess I can just make the button pup up the ask for input box. I ended up putting a turnoff=1 flag in the mouse click function.
At the beginning of the script i stuck:
if (turnoff==1) Trade=false;
This disables the Trade function parameter variable but like you said the value doesnt match the menu option and I have to reload the script if I want to turn it back on. Which is fine. I just wanted a QUICK way to stop sending trades to the broker incase there was an major event or problem. It doesnt really matter that the menu doesnt sync up.
Comment
Comment