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; int start = 0;
// // //
if (prevCalculated == 0) // if (prevCalculated == 0)
{ // {
// // //
if (max > 0) // if (max > 0)
{ // {
for (int i = 0; i < max; i++) // for (int i = 0; i < max; i++)
{ // {
// // //
for (int j = 0; j < CountBuffers(); j++) // for (int j = 0; j < CountBuffers(); j++)
{ // {
mBuffers[j].Add(0); // mBuffers[j].Add(0);
} // }
} // }
} // }
} // }
// //
// Loop through Bars ... // Loop through Bars ...
for (int i = totalBars - 1; i >= start && !IsStopped(); i--) for (int i = start; i< totalBars; i++) {
{
// //
XOHCL iBar; XOHCL iBar;
iBar.Init( iBar.Init(
@@ -319,17 +318,39 @@ public:
double iValue = iBar.close; double iValue = iBar.close;
// //
// Print("BarIndex: " + ToString(i), ", iValue: ", iValue); int count = mBuffers[mainIDX].Count();
if (count > 0 && i == count - 1) {
// mBuffers[mainIDX].Set(i, iValue);
if (i > ArraySize(mBuffers[mainIDX].values) - 1) } else {
{ mBuffers[mainIDX].Add(iValue);
ArrayResize(mBuffers[mainIDX].values, i + 1); }
} }
// // for (int i = totalBars - 1; i >= start && !IsStopped(); i--)
mBuffers[mainIDX].values[i] = iValue; // {
} // //
// 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 ... // Prevent Double Calculation Same Bars ...
+2
View File
@@ -784,6 +784,8 @@ public:
// //
void HandleTrailManagement(XPosition &positions[]) void HandleTrailManagement(XPosition &positions[])
{ {
//
return;
// //
// TODO: // TODO:
// Make them Configurable ... // Make them Configurable ...
+19 -6
View File
@@ -70,6 +70,7 @@ struct XBuffer
// //
title = mTitle; title = mTitle;
// ArraySetAsSeries(values, false);
// //
result = IsValid(); result = IsValid();
@@ -174,6 +175,19 @@ struct XBuffer
return result; return result;
} }
//
void Set(
int index,
double value //
)
{
//
NormalizeIndex(index, values);
//
values[index] = value;
}
// //
// Get Specified Index Value ... // Get Specified Index Value ...
double Get( double Get(
@@ -562,6 +576,10 @@ public:
// //
Calculate(); Calculate();
//
bool asSeries = ArrayGetAsSeries(buffer);
ArraySetAsSeries(buffer, false);
// //
result = ArrayCopy( result = ArrayCopy(
buffer, buffer,
@@ -572,12 +590,7 @@ public:
); );
// //
// for (int i = start; i < start + count - 1; i++) ArraySetAsSeries(buffer, asSeries);
// {
// //
// result++;
// buffer[i] = mBuffers[bufferIDX].values[i];
// }
// //
return result; return result;
+6 -6
View File
@@ -120,7 +120,7 @@ int OnCalculate(
// //
// //
Print("Limit: ", limit); // Print("Limit: ", limit);
// mMid.Calculate(); // mMid.Calculate();
// //
@@ -130,10 +130,10 @@ int OnCalculate(
0, 0,
limit // limit //
); );
if (!IsValidSize(midMainBufferCopied)) // if (!IsValidSize(midMainBufferCopied))
{ // {
return prev_calculated; // return prev_calculated;
} // }
// //
// ChartRedraw(); // ChartRedraw();
@@ -202,7 +202,7 @@ void DefineBuffers()
// //
// mainBufferStruct.asSeries // mainBufferStruct.asSeries
// ArraySetAsSeries(mainBuffer, mainBufferStruct.asSeries); // ArraySetAsSeries(mainBuffer, false);
// //
XBufferPlotStyle mainBufferStyle; XBufferPlotStyle mainBufferStyle;