Current value of symbol

Created at 01 May 2013, 19:54
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!
Click's avatar

Click

Joined 01.05.2013

Current value of symbol
01 May 2013, 19:54


How can I store the current value of the symbol, and put it in a variable, which doesnt get updated when the price changes, for later reference/comparison?

 

For example when two moving averages crosses, at this moment store double cross1 = current value of the symbol, and so on for double cross1,2,3 etc, for later reference.

 

if "something happens"{

       double one = Symbol.Ask/Bid at this specific moment

so I have this price stored for later reference, without Symbol.Ask etc continuously updating it.....

 

There may be som TimeSeries variable etc, what I want is to store the prica at a specific moment when something happens, not have a log of prices for many periods, maybe I can use current period is equal variable, but still my question would be the same. Hope someone can help me on my way :)

 

 


@Click
Replies

cAlgo_Fanatic
07 May 2013, 12:01

// Global scope, outside any method (function)
private double one = 0.0;

// local scope, e.g. inside the OnTick event
bool somethingHappens = Symbol.Ask.Equals(1.2); // for instance

if (somethingHappens && one.Equals(0.0))
{
    // if one does not equal zero, execution of the program will not reach here
    one = Symbol.Ask;  
}

 


@cAlgo_Fanatic