I'm not quite sure how to ask my question in C # terms, so please carry with a long explanation.
I am writing a stock trading algorithm. When the algorithm starts, it checks to which instrument it is applied (in this case, to stock or futures), and then assigns the value "double x" depending on the instrument.
If this is a future tool, then the assignment is a simple, flat value (in this case, “double x = 5;). However, if its margin, I would like the“ x ”to be assigned a value from another object - allows you to call the object“ Algo2 " and the value is “y.” Thus, in my script, the assignment is as follows: “double x = Algo2.y” (note: the convention in the editor I'm using). This block of code runs only once when the algorithm starts .
What I'm trying to achieve here is to tell my algorithm to get the last value of "Algo2.y" whenever "x" is used in a formula such as "EntryValue = Price + x". However, it happens that "x" is constantly assigned the value "Algo2.y" at the beginning of the program, and since this block never starts again, it remains unchanged.
Can someone help with the syntax so that instead of assigning the value "x", he would simply point to the last value "Algo2.y" if he would call?
Thank!
source
share