Login Page - Create Account

Support Board


Date/Time: Sun, 29 Jun 2025 02:50:00 +0000



Post From: Custom study disappearing after removing an indicator

[2021-08-16 17:58:21]
BenjFlame - Posts: 338
Thanks but it is not the solution. And I'm the developer of the study, although getting started with ACSIL.

Do you spot something that could cause the issue in this:

*============================================================================
Bar coloring VS volume average
----------------------------------------------------------------------------*/
SCSFExport scsf_BarColorAverageVolStrength(SCStudyInterfaceRef sc)
{

// Subgraphs name attributions
SCSubgraphRef VolumeVsVolAverage_Sub = sc.Subgraph[0];
SCSubgraphRef VolumeAverageFromRef_Sub = sc.Subgraph[1];

// Create inputs
SCInputRef Input_EnableSmoothing = sc.Input[0];
SCInputRef Input_WaitFiveSeconds = sc.Input[1];
SCInputRef Input_StudyId = sc.Input[2];
SCInputRef Input_SubgraphId = sc.Input[3];

if (sc.SetDefaults)
{
// Set the defaults
sc.CalculationPrecedence = LOW_PREC_LEVEL;

sc.GraphName = "BAR COLORING: VS VOL AVG";


// Subrgraphs setup
VolumeVsVolAverage_Sub.Name = "VOL STR VS VOL AVG";
VolumeVsVolAverage_Sub.DrawStyle = DRAWSTYLE_COLOR_BAR_HOLLOW;

VolumeAverageFromRef_Sub.Name = "Volume Average from ref";
VolumeAverageFromRef_Sub.DrawStyle = DRAWSTYLE_HIDDEN;

// Set inputs
Input_EnableSmoothing.Name = "Enable Smoothing";
Input_EnableSmoothing.SetYesNo(0);

Input_WaitFiveSeconds.Name = "Wait 5 Seconds";
Input_WaitFiveSeconds.SetYesNo(1);

Input_StudyId.Name = "Study ID (Ma Simple on volume)";
Input_StudyId.SetInt(13);

Input_SubgraphId.Name = "SubGraph ID";
Input_SubgraphId.SetInt(0);

sc.AutoLoop = 1;

// Enter any additional configuration code here

return;
}

// Perform your data processing here.
float vol = sc.Volume[sc.Index];
float Elapsed = sc.BaseDataEndDateTime[sc.Index].GetTimeInSeconds() - sc.BaseDateTimeIn[sc.Index].GetTimeInSeconds();
float SecondsPerBar = 0;
float Multiplicator = 0;
float VolumeProjection = 0;
float VolumeProjectionPercentVsVolAvg = 0;
float ElapsedPercent = 0;


// Wait 5 sesconds
if (Elapsed < 5 && Input_WaitFiveSeconds.GetInt() == 1)
{
return;
}

// If bar is proper time bar
n_ACSIL::s_BarPeriod BarPeriod;
sc.GetBarPeriodParameters(BarPeriod);
if (BarPeriod.ChartDataType == INTRADAY_DATA && BarPeriod.IntradayChartBarPeriodType == IBPT_DAYS_MINS_SECS && Elapsed > 0 )
{


// Build vol moving average from the other study on chart
SCFloatArray StudyReferenceVol;
float VolMovingAverage = 0;
if (sc.GetStudyArrayUsingID(Input_StudyId.GetInt(), Input_SubgraphId.GetInt(), StudyReferenceVol) > 0 && StudyReferenceVol.GetArraySize() > 0)
{
//Copy the study data that we retrieved using GetStudyArrayUsingID, into a subgraph data output array
VolumeAverageFromRef_Sub[sc.Index] = StudyReferenceVol[sc.Index];
VolMovingAverage = VolumeAverageFromRef_Sub[sc.Index];
}

SecondsPerBar = BarPeriod.IntradayChartBarPeriodParameter1;
Multiplicator = SecondsPerBar / Elapsed;
VolumeProjection = vol * Multiplicator;


// Smoothing the projection
if (Input_EnableSmoothing.GetInt() == 1) {
ElapsedPercent = (Elapsed * 100) / SecondsPerBar;
if (ElapsedPercent <= 9 ) {
VolumeProjection *= 0.60;
} else if (ElapsedPercent >= 10 && ElapsedPercent <= 19) {
VolumeProjection *= 0.70;
} else if (ElapsedPercent >= 20 && ElapsedPercent <= 30) {
VolumeProjection *= 0.80;
} else {
VolumeProjection *= 1;
}
}



    VolumeProjectionPercentVsVolAvg = ( VolumeProjection * 100) / VolMovingAverage;
VolumeVsVolAverage_Sub[sc.Index] = VolumeProjectionPercentVsVolAvg;


// Outline coloring
SCSubgraphRef CalculationChoice = VolumeVsVolAverage_Sub;


if (CalculationChoice[sc.Index] >= 0 && CalculationChoice[sc.Index] <= 14 )
{
CalculationChoice.DataColor[sc.Index] = RGB(35, 35, 35);
} else


if (CalculationChoice[sc.Index] > 209 && CalculationChoice[sc.Index] <= 224)
{
CalculationChoice.DataColor[sc.Index] = RGB(242, 255, 0);
} else

if (CalculationChoice[sc.Index] > 224 )

{
CalculationChoice.DataColor[sc.Index] = RGB(255, 255, 255);
}


return;
}

return;
}

Date Time Of Last Edit: 2021-08-16 17:59:42