Login Page - Create Account

Support Board


Date/Time: Sat, 11 May 2024 20:18:56 +0000



Problem with s_VolumeAtPriceV2 in latest versions of SC

View Count: 1371

[2018-11-18 16:21:21]
User517260 - Posts: 97
Dear support,

in latest version of SC 1842 64 bit I found my old code, used s_VolumeAtPriceV2 data, does not work as before. I also found - if I will apply on same chart "TPO Profile Chart" study and then remove it - my code sart works good. You may see it on short video https://youtu.be/xXgMzxWO39A . As I understand, TPO Profile Chart is uploading data into s_VolumeAtPriceV2 structure and that is why I can get this data after TPO study was applied. My code is following:

  int MaxVolume = 0;
  int Volume1TickOverPOC = 0;
  int Volume1TickUnderPOC = 0;
  float VolumePOCPrice = 0;
  int TotalAskVol = 0;
  int TotalBidVol = 0;
  
  s_VolumeAtPriceV2 *p_VolumeAtPriceAtIndex;
  int Count = sc.VolumeAtPriceForBars-> GetSizeAtBarIndex(sc.Index);
  for (int ElementIndex = Count-1;ElementIndex >= 0; ElementIndex --){
    sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, ElementIndex, &p_VolumeAtPriceAtIndex);
    if (p_VolumeAtPriceAtIndex){
      int AskVol = p_VolumeAtPriceAtIndex->AskVolume;
      int BidVol = p_VolumeAtPriceAtIndex->BidVolume;
      int NumOfTrades = p_VolumeAtPriceAtIndex->NumberOfTrades;
      float Price = p_VolumeAtPriceAtIndex->PriceInTicks * sc.TickSize;
      TotalAskVol = TotalAskVol + AskVol;
      TotalBidVol = TotalBidVol + BidVol;
      
      if(AskVol + BidVol > MaxVolume){
        MaxVolume = AskVol + BidVol;
        VolumePOCPrice = Price;

        if(ElementIndex < Count - 1){
          sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, ElementIndex + 1, &p_VolumeAtPriceAtIndex);
          AskVol = p_VolumeAtPriceAtIndex->AskVolume;
          BidVol = p_VolumeAtPriceAtIndex->BidVolume;
          Volume1TickOverPOC = AskVol + BidVol;
        }
        else Volume1TickOverPOC = 0;

        if(ElementIndex > 0){
          sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, ElementIndex - 1, &p_VolumeAtPriceAtIndex);
          AskVol = p_VolumeAtPriceAtIndex->AskVolume;
          BidVol = p_VolumeAtPriceAtIndex->BidVolume;
          Volume1TickUnderPOC = AskVol + BidVol;
        }
        else Volume1TickUnderPOC = 0;
      }
    }
  }
  
  POC_Sub[sc.Index]     = VolumePOCPrice;
  POCValue_Sub[sc.Index]   = (float)MaxVolume;
    
  float BARatio       = (float)(100*(TotalAskVol - TotalBidVol));    
  VolRatio_Sub[sc.Index]   = (float)BARatio/(TotalAskVol + TotalBidVol);


It was good before I updated SC. So, Could you tell me what I have to change in my code to get data from s_VolumeAtPriceV2 structure without TPO study appying before? Waiting for your reply as soon as possible, because it is a commercial project and customer is waiting for fixing of this bug. Thanks. Alex.
[2018-11-18 16:35:47]
User907968 - Posts: 802
In your code, have you set sc.MaintainVolumeAtPriceData = 1?

ACSIL Interface Members - Variables and Arrays: sc.MaintainVolumeAtPriceData
[2018-11-18 17:15:47]
User517260 - Posts: 97
no. Is it needed?

I also found another my study generate another results, it doesn't use Volume data. How could I get installation of SC with version 1837 or below?

Thanks, Alex.
[2018-11-18 17:21:56]
User517260 - Posts: 97
Yes, thanks, sc.MaintainVolumeAtPriceData = 1 helped to decide this problem, thanks a lot!

So, now problem with other my study is not clear for me. I'd like to download 1837 or earlier version to look once more - what is different.
[2018-11-18 21:00:57]
Sierra Chart Engineering - Posts: 104368
Yes you do need to set this to 1:
ACSIL Interface Members - Variables and Arrays: sc.MaintainVolumeAtPriceData

So, now problem with other my study is not clear for me.
Tell us what the problem is.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-11-24 20:20:46]
User517260 - Posts: 97
Hi! It was my mistake, so last question is canceled.

I have new situation - I use in one study a few subgraphs:

SCSubgraphRef ID2_Background_Sub         = sc.Subgraph[3];
SCSubgraphRef ID17_BuyCandle_Sub        = sc.Subgraph[19];
SCSubgraphRef ID16_SellCandle_Sub        = sc.Subgraph[20];


  ID2_Background_Sub.Name = "ID2: Background";
  ID2_Background_Sub.DrawStyle = DRAWSTYLE_BACKGROUND_TRANSPARENT;
  ID2_Background_Sub.PrimaryColor = RGB(64,64,64);
  ID2_Background_Sub.DrawZeros = false;
  ID2_Background_Sub.DisplayNameValueInWindowsFlags = 0;

  ID17_BuyCandle_Sub.Name = "ID17: BUY CANDLE";
  ID17_BuyCandle_Sub.DrawStyle = DRAWSTYLE_COLOR_BAR_CANDLE_FILL;
  ID17_BuyCandle_Sub.PrimaryColor = RGB(0, 157, 0);
  ID17_BuyCandle_Sub.DrawZeros = false;

  ID16_SellCandle_Sub.Name = "ID16: SELL CANDLE";
  ID16_SellCandle_Sub.DrawStyle = DRAWSTYLE_COLOR_BAR_CANDLE_FILL;
  ID16_SellCandle_Sub.PrimaryColor = RGB(64, 0, 64);
  ID16_SellCandle_Sub.DrawZeros = false;
    
Problem is - background hides candles. If I use DRAWSTYLE_IGNORE for backgronud - I see normal colored candles, but I can't see background and colored candles same time - it is a problem, because I need to have only one study which draws background depend of time and colored candles. What I have to do to decide this problem? Thanks!
[2018-11-27 13:32:38]
User517260 - Posts: 97
I reopened request in new thread. Current session has to be closed. Thanks!

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

Login

Login Page - Create Account