last ...
This commit is contained in:
@@ -55,6 +55,174 @@ class XCBarAnalyser : public XSCBase
|
|||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Loopback Data for Specific Bar ...
|
||||||
|
*
|
||||||
|
* @param index: Integer, Bar Current Index ...
|
||||||
|
* @param start: Integer, Start of Loopback ...
|
||||||
|
* @param end: Integer, End of Loopback ...
|
||||||
|
* @param count: Integer, Number of Calculating Bars ...
|
||||||
|
* @param bar: XOHCL instance, Specified Bar ...
|
||||||
|
* @param loopback: Integer, Loopback Length ...
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CalculateLoopBackData(
|
||||||
|
int &index,
|
||||||
|
int &start,
|
||||||
|
int &end,
|
||||||
|
int &count,
|
||||||
|
XOHCL &bar,
|
||||||
|
int loopback = 1 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (loopback < 1)
|
||||||
|
{
|
||||||
|
loopback = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
index = -1;
|
||||||
|
start = -1;
|
||||||
|
end = -1;
|
||||||
|
count = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
index = bar.Index();
|
||||||
|
start = index + 1;
|
||||||
|
end = start + loopback;
|
||||||
|
count = end - start;
|
||||||
|
result = count >= 1;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Loopback HH & LL Data ...
|
||||||
|
*
|
||||||
|
* @param hhIDX: Integer, HH Index ...
|
||||||
|
* @param hh: Double, HH Value ...
|
||||||
|
* @param llIDX: Integer, LL Index ...
|
||||||
|
* @param ll: Double, LL Value ...
|
||||||
|
* @param bar: XOHCL instance ...
|
||||||
|
* @param loopback: Integer, Loopback Length ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CalculateLoopbackHLData(
|
||||||
|
int &hhIDX,
|
||||||
|
double &hh,
|
||||||
|
int &llIDX,
|
||||||
|
double &ll,
|
||||||
|
XOHCL &bar,
|
||||||
|
int loopback //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (loopback < 1)
|
||||||
|
{
|
||||||
|
loopback = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int index = -1;
|
||||||
|
int start = -1;
|
||||||
|
int end = -1;
|
||||||
|
int count = -1;
|
||||||
|
result = CalculateLoopBackData(
|
||||||
|
index,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
count,
|
||||||
|
bar,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
hhIDX = iHighest(
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
MODE_HIGH,
|
||||||
|
count,
|
||||||
|
start //
|
||||||
|
);
|
||||||
|
result = IsValidIndex(hhIDX);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
llIDX = iLowest(
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
MODE_LOW,
|
||||||
|
count,
|
||||||
|
start //
|
||||||
|
);
|
||||||
|
result = IsValidIndex(llIDX);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
hh = iHigh(
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
hhIDX //
|
||||||
|
);
|
||||||
|
ll = iLow(
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
llIDX //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Bar Range ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance ...
|
||||||
|
*
|
||||||
|
* @return ( double )
|
||||||
|
*/
|
||||||
|
double GetBarRangePercent(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.GetRange() / 100;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Commons ...
|
// Commons ...
|
||||||
|
|
||||||
@@ -1176,177 +1344,6 @@ class XCBarAnalyser : public XSCBase
|
|||||||
protected:
|
protected:
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
|
||||||
// Actions ...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate Loopback Data for Specific Bar ...
|
|
||||||
*
|
|
||||||
* @param index: Integer, Bar Current Index ...
|
|
||||||
* @param start: Integer, Start of Loopback ...
|
|
||||||
* @param end: Integer, End of Loopback ...
|
|
||||||
* @param count: Integer, Number of Calculating Bars ...
|
|
||||||
* @param bar: XOHCL instance, Specified Bar ...
|
|
||||||
* @param loopback: Integer, Loopback Length ...
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool CalculateLoopBackData(
|
|
||||||
int &index,
|
|
||||||
int &start,
|
|
||||||
int &end,
|
|
||||||
int &count,
|
|
||||||
XOHCL &bar,
|
|
||||||
int loopback = 1 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (loopback < 1)
|
|
||||||
{
|
|
||||||
loopback = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
index = -1;
|
|
||||||
start = -1;
|
|
||||||
end = -1;
|
|
||||||
count = -1;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = bar.IsValid();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
index = bar.Index();
|
|
||||||
start = index + 1;
|
|
||||||
end = start + loopback;
|
|
||||||
count = end - start;
|
|
||||||
result = count >= 1;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve Loopback HH & LL Data ...
|
|
||||||
*
|
|
||||||
* @param hhIDX: Integer, HH Index ...
|
|
||||||
* @param hh: Double, HH Value ...
|
|
||||||
* @param llIDX: Integer, LL Index ...
|
|
||||||
* @param ll: Double, LL Value ...
|
|
||||||
* @param bar: XOHCL instance ...
|
|
||||||
* @param loopback: Integer, Loopback Length ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool CalculateLoopbackHLData(
|
|
||||||
int &hhIDX,
|
|
||||||
double &hh,
|
|
||||||
int &llIDX,
|
|
||||||
double &ll,
|
|
||||||
XOHCL &bar,
|
|
||||||
int loopback //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (loopback < 1)
|
|
||||||
{
|
|
||||||
loopback = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int index = -1;
|
|
||||||
int start = -1;
|
|
||||||
int end = -1;
|
|
||||||
int count = -1;
|
|
||||||
result = CalculateLoopBackData(
|
|
||||||
index,
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
count,
|
|
||||||
bar,
|
|
||||||
loopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
hhIDX = iHighest(
|
|
||||||
bar.symbol,
|
|
||||||
bar.period,
|
|
||||||
MODE_HIGH,
|
|
||||||
count,
|
|
||||||
start //
|
|
||||||
);
|
|
||||||
result = IsValidIndex(hhIDX);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
llIDX = iLowest(
|
|
||||||
bar.symbol,
|
|
||||||
bar.period,
|
|
||||||
MODE_LOW,
|
|
||||||
count,
|
|
||||||
start //
|
|
||||||
);
|
|
||||||
result = IsValidIndex(llIDX);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
hh = iHigh(
|
|
||||||
bar.symbol,
|
|
||||||
bar.period,
|
|
||||||
hhIDX //
|
|
||||||
);
|
|
||||||
ll = iLow(
|
|
||||||
bar.symbol,
|
|
||||||
bar.period,
|
|
||||||
llIDX //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate Bar Range ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL instance ...
|
|
||||||
*
|
|
||||||
* @return ( double )
|
|
||||||
*/
|
|
||||||
double GetBarRangePercent(XOHCL &bar)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = bar.GetRange() / 100;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user