This commit is contained in:
2024-05-30 12:32:21 +03:30
parent 9cfd0b7802
commit 0aff395f39
4 changed files with 75 additions and 39 deletions
+48 -27
View File
@@ -286,27 +286,26 @@ public:
//
int start = 0;
//
if (prevCalculated == 0)
{
//
if (max > 0)
{
for (int i = 0; i < max; i++)
{
//
for (int j = 0; j < CountBuffers(); j++)
{
mBuffers[j].Add(0);
}
}
}
}
// //
// if (prevCalculated == 0)
// {
// //
// if (max > 0)
// {
// for (int i = 0; i < max; i++)
// {
// //
// for (int j = 0; j < CountBuffers(); j++)
// {
// mBuffers[j].Add(0);
// }
// }
// }
// }
//
// Loop through Bars ...
for (int i = totalBars - 1; i >= start && !IsStopped(); i--)
{
for (int i = start; i< totalBars; i++) {
//
XOHCL iBar;
iBar.Init(
@@ -319,18 +318,40 @@ public:
double iValue = iBar.close;
//
// Print("BarIndex: " + ToString(i), ", iValue: ", iValue);
//
if (i > ArraySize(mBuffers[mainIDX].values) - 1)
{
ArrayResize(mBuffers[mainIDX].values, i + 1);
int count = mBuffers[mainIDX].Count();
if (count > 0 && i == count - 1) {
mBuffers[mainIDX].Set(i, iValue);
} else {
mBuffers[mainIDX].Add(iValue);
}
//
mBuffers[mainIDX].values[i] = iValue;
}
// for (int i = totalBars - 1; i >= start && !IsStopped(); i--)
// {
// //
// XOHCL iBar;
// iBar.Init(
// mSymbol,
// mPeriod,
// i //
// );
// //
// double iValue = iBar.close;
// //
// // Print("BarIndex: " + ToString(i), ", iValue: ", iValue);
// //
// if (i > ArraySize(mBuffers[mainIDX].values) - 1)
// {
// ArrayResize(mBuffers[mainIDX].values, i + 1);
// }
// //
// mBuffers[mainIDX].values[i] = iValue;
// }
//
// Prevent Double Calculation Same Bars ...
mCalculatedBars = totalBars;
+2
View File
@@ -784,6 +784,8 @@ public:
//
void HandleTrailManagement(XPosition &positions[])
{
//
return;
//
// TODO:
// Make them Configurable ...
+19 -6
View File
@@ -70,6 +70,7 @@ struct XBuffer
//
title = mTitle;
// ArraySetAsSeries(values, false);
//
result = IsValid();
@@ -174,6 +175,19 @@ struct XBuffer
return result;
}
//
void Set(
int index,
double value //
)
{
//
NormalizeIndex(index, values);
//
values[index] = value;
}
//
// Get Specified Index Value ...
double Get(
@@ -562,6 +576,10 @@ public:
//
Calculate();
//
bool asSeries = ArrayGetAsSeries(buffer);
ArraySetAsSeries(buffer, false);
//
result = ArrayCopy(
buffer,
@@ -572,12 +590,7 @@ public:
);
//
// for (int i = start; i < start + count - 1; i++)
// {
// //
// result++;
// buffer[i] = mBuffers[bufferIDX].values[i];
// }
ArraySetAsSeries(buffer, asSeries);
//
return result;
+6 -6
View File
@@ -120,7 +120,7 @@ int OnCalculate(
//
//
Print("Limit: ", limit);
// Print("Limit: ", limit);
// mMid.Calculate();
//
@@ -130,10 +130,10 @@ int OnCalculate(
0,
limit //
);
if (!IsValidSize(midMainBufferCopied))
{
return prev_calculated;
}
// if (!IsValidSize(midMainBufferCopied))
// {
// return prev_calculated;
// }
//
// ChartRedraw();
@@ -202,7 +202,7 @@ void DefineBuffers()
//
// mainBufferStruct.asSeries
// ArraySetAsSeries(mainBuffer, mainBufferStruct.asSeries);
// ArraySetAsSeries(mainBuffer, false);
//
XBufferPlotStyle mainBufferStyle;