Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 16:53:56 +0000



Get Value from Object without Reference

View Count: 223

[2023-07-21 10:14:04]
Bartezz - Posts: 18
Hi Team,

i try to get Value from Object, store it to variable to use this value later, but if the Value of object is changed, then the value of this variable is changing as well (also all older Messelogs).
How can i get Value from this Object without any changing?

Here is my Code

          s_MarketDepthEntry DepthEntryBid;
          s_MarketDepthEntry DepthEntryAsk;
          sc.GetBidMarketDepthEntryAtLevel(DepthEntryBid, 0);
          sc.GetAskMarketDepthEntryAtLevel(DepthEntryAsk, 0);
          
          Last_Bid_Limit_Size = DepthEntryBid.Quantity;
          Last_Ask_Limit_Size = DepthEntryAsk.Quantity;

Regards
[2023-07-21 12:15:09]
Sierra_Chart Engineering - Posts: 17195
This will not be the case:
but if the Value of object is changed, then the value of this variable is changing as well

However, if this code is executing every time you are using a copy of a value, then you are always getting the current depth values:

s_MarketDepthEntry DepthEntryBid;
s_MarketDepthEntry DepthEntryAsk;
sc.GetBidMarketDepthEntryAtLevel(DepthEntryBid, 0);
sc.GetAskMarketDepthEntryAtLevel(DepthEntryAsk, 0);

Last_Bid_Limit_Size = DepthEntryBid.Quantity;
Last_Ask_Limit_Size = DepthEntryAsk.Quantity;

You may want to look at persistent variables:
Persistent Variable Functions
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account