Login Page - Create Account

Support Board


Date/Time: Sat, 01 Feb 2025 00:43:24 +0000



Post From: Help with a study that's not working after updating version

[2019-06-05 18:19:46]
User66360 - Posts: 81
This no long works. It use to work on an older version. Is there something in code you can fix to make it work again. Thanks


#include "sierrachart.h"
#include "scstudyfunctions.h"
#include <math.h>
SCDLLName("High Volume At Price")

SCSFExport scsf_HighVAP(SCStudyInterfaceRef sc)
{
SCSubgraphRef MaxVAP = sc.Subgraph[0];

if (sc.SetDefaults)
{
// During development set this flag to 1, so the DLL can be modified. When development is done, set it to 0 to improve performance.
sc.FreeDLL = 0;

sc.GraphName = "High Volume At Price";
sc.StudyDescription = "Display high volume at price for each bar.";
sc.AutoLoop = 1;
sc.GraphRegion = 0;
sc.ScaleRangeType = SCALE_SAMEASREGION;
sc.MaintainVolumeAtPriceData = 1;

MaxVAP.Name = "MaxVAP";
MaxVAP.DrawStyle = DRAWSTYLE_DASH;
MaxVAP.LineWidth = 2;
MaxVAP.PrimaryColor = COLOR_YELLOW;

return;
}

if ((int)sc.VolumeAtPriceForBars->GetNumberOfBars() < sc.ArraySize)
return;

unsigned int MaxVolume = 0;
float MaxVolumePrice = 0;

int Count = sc.VolumeAtPriceForBars->GetSizeAtBarIndex(sc.Index);

for (int ElementIndex = 0; ElementIndex < Count; ElementIndex++)
{
s_VolumeAtPriceV2* p_VolumeAtPriceAtIndex = 0;
sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, ElementIndex, &p_VolumeAtPriceAtIndex);

if (p_VolumeAtPriceAtIndex &&
p_VolumeAtPriceAtIndex->Volume > MaxVolume)
{
MaxVolume = p_VolumeAtPriceAtIndex->Volume;
MaxVolumePrice = p_VolumeAtPriceAtIndex->PriceInTicks * sc.TickSize;
}
}

MaxVAP[sc.Index] = MaxVolumePrice;
}