This commit is contained in:
2025-09-15 13:18:25 +03:30
parent cc403082ed
commit 9e2f375fbe
5 changed files with 3802 additions and 1248 deletions
File diff suppressed because it is too large Load Diff
+528 -81
View File
@@ -66,8 +66,8 @@ class XCChartHelper : public XCBase
* @return ( bool ) * @return ( bool )
*/ */
bool Navigate( bool Navigate(
const ENUM_CHART_POSITION position, ENUM_CHART_POSITION position,
const int shift // int shift //
) )
{ {
return (ChartNavigate(mChartID, position, shift)); return (ChartNavigate(mChartID, position, shift));
@@ -80,11 +80,110 @@ class XCChartHelper : public XCBase
* *
* @return ( bool ) * @return ( bool )
*/ */
bool ApplyTemplate(const string filename) const bool ApplyTemplate(string filename)
{ {
return (ChartApplyTemplate(mChartID, filename)); return (ChartApplyTemplate(mChartID, filename));
} }
/**
* Add Specified Indicator to Chart ...
*
* @param subWindow: int ...
* @param handle: int ...
*
* @return ( bool )
*/
bool IndicatorAdd(int subWindow, int handle)
{
//
// Normalize Subwindow ...
if (subWindow <= 0)
{
subWindow = 0;
}
//
return (ChartIndicatorAdd(mChartID, subWindow, handle));
}
/**
* Delete Specified Indicator from Chart ...
*
* @param subWindow: int ...
* @param name: string ...
*
* @return ( bool )
*/
bool IndicatorDelete(int subWindow, string name)
{
//
// Normalize Subwindow ...
if (subWindow <= 0)
{
subWindow = 0;
}
//
return (ChartIndicatorDelete(mChartID, subWindow, name));
}
/**
* Count all Charts Indicator ...
*
* @param subWindow: int ...
*
* @return ( int )
*/
int IndicatorsTotal(int subWindow)
{
//
// Normalize Subwindow ...
if (subWindow <= 0)
{
subWindow = 0;
}
//
return (ChartIndicatorsTotal(mChartID, subWindow));
}
/**
* Get Specified Indexed Indicator's Name ...
*
* @param subWindow: int ...
* @param index: int ...
*
* @return ( string )
*/
string IndicatorName(int subWindow, int index)
{
//
// Normalize Subwindow ...
if (subWindow <= 0)
{
subWindow = 0;
}
//
return (ChartIndicatorName(mChartID, subWindow, index));
}
/**
* Set Chart Symbol, Period ...
*
* @param symbol: string ...
* @param period: ENUM_TIMEFRAMES ...
*
* @return ( bool )
*/
bool SetSymbolPeriod(
string symbol,
ENUM_TIMEFRAMES period //
)
{
return (ChartSetSymbolPeriod(mChartID, symbol, period));
}
/** /**
* Take an Screenshot of Chart ... * Take an Screenshot of Chart ...
* *
@@ -113,88 +212,436 @@ class XCChartHelper : public XCBase
// //
string work_str; string work_str;
int work_int; int work_int;
//--- check
//
bool has = false;
//
// Validate ...
if (file_handle == INVALID_HANDLE || mChartID == -1) if (file_handle == INVALID_HANDLE || mChartID == -1)
return (false); {
//--- write start marker - 0xFFFFFFFFFFFFFFFF return has;
if (FileWriteLong(file_handle, -1) != sizeof(long)) }
return (false);
//--- write chart type //
if (FileWriteInteger(file_handle, Type(), INT_VALUE) != INT_VALUE) // Write start marker - 0xFFFFFFFFFFFFFFFF ...
return (false); has = FileWriteLong(file_handle, -1) == sizeof(long);
//--- write chart symbol if (!has)
{
return has;
}
//
// Write chart type ...
has = FileWriteInteger(file_handle, Type(), INT_VALUE) == INT_VALUE;
if (!has)
{
return has;
}
//
// Write chart symbol ...
work_str = Symbol(); work_str = Symbol();
work_int = StringLen(work_str); work_int = StringLen(work_str);
if (FileWriteInteger(file_handle, work_int, INT_VALUE) != INT_VALUE) has = FileWriteInteger(file_handle, work_int, INT_VALUE) == INT_VALUE;
return (false); if (!has)
{
return has;
}
if (work_int != 0) if (work_int != 0)
if (FileWriteString(file_handle, work_str, work_int) != work_int) {
return (false); //
//--- write period of chart has = FileWriteString(file_handle, work_str, work_int) == work_int;
if (FileWriteInteger(file_handle, Period(), INT_VALUE) != sizeof(int)) if (!has)
return (false); {
//--- write value of the "Mode" property return has;
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_MODE), INT_VALUE) != sizeof(int)) }
return (false); }
//--- write value of the "Foreground" property
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_FOREGROUND), CHAR_VALUE) != sizeof(char)) //
return (false); // Write Period of chart ...
//--- write value of the "Shift" property has = FileWriteInteger(file_handle, Period(), INT_VALUE) == sizeof(int);
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHIFT), CHAR_VALUE) != sizeof(char)) if (!has)
return (false); {
//--- write value of the "ShiftSize" property return has;
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHIFT), INT_VALUE) != sizeof(int)) }
return (false);
//--- write value of the "AutoScroll" property //
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_AUTOSCROLL), CHAR_VALUE) != sizeof(char)) // Write value of the "Mode" property ...
return (false); has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_MODE), INT_VALUE) == sizeof(int);
//--- write value of the "Scale" property if (!has)
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALE), INT_VALUE) != sizeof(int)) {
return (false); return has;
//--- write value of the "ScaleFix" property }
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALEFIX), CHAR_VALUE) != sizeof(char))
return (false); //
//--- write value of the "ScaleFix_11" property // Write value of the "Foreground" property ...
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALEFIX_11), CHAR_VALUE) != sizeof(char)) has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_FOREGROUND), CHAR_VALUE) == sizeof(char);
return (false); if (!has)
//--- write value of the "FixedMax" property {
if (FileWriteDouble(file_handle, ChartGetDouble(mChartID, CHART_FIXED_MAX)) != sizeof(double)) return has;
return (false); }
//--- write value of the "FixedMin" property
if (FileWriteDouble(file_handle, ChartGetDouble(mChartID, CHART_FIXED_MIN)) != sizeof(double)) //
return (false); // Write value of the "Shift" property ...
//--- write the "ScalePPB" property has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHIFT), CHAR_VALUE) == sizeof(char);
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALE_PT_PER_BAR), CHAR_VALUE) != sizeof(char)) if (!has)
return (false); {
//--- write value of the "PointsPerBar" property return has;
if (FileWriteDouble(file_handle, ChartGetDouble(mChartID, CHART_POINTS_PER_BAR)) != sizeof(double)) }
return (false);
//--- write value of the "ShowOHLC" property //
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_OHLC), CHAR_VALUE) != sizeof(char)) // Write value of the "ShiftSize" property ...
return (false); has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHIFT), INT_VALUE) == sizeof(int);
//--- write value of the "ShowLineBid" property if (!has)
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_BID_LINE), CHAR_VALUE) != sizeof(char)) {
return (false); return has;
//--- write value of the "ShowLineAsk" property }
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_ASK_LINE), CHAR_VALUE) != sizeof(char))
return (false); //
//--- write value of the "ShowLastLine" property // Write value of the "AutoScroll" property ...
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_LAST_LINE), CHAR_VALUE) != sizeof(char)) has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_AUTOSCROLL), CHAR_VALUE) == sizeof(char);
return (false); if (!has)
//--- write value of the "ShowPeriodSep" property {
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_PERIOD_SEP), CHAR_VALUE) != sizeof(char)) return has;
return (false); }
//--- write value of the "ShowGrid" property
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_GRID), CHAR_VALUE) != sizeof(char)) //
return (false); // Write value of the "Scale" property ...
//--- write value of the "ShowVolumes" property has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALE), INT_VALUE) == sizeof(int);
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_VOLUMES), INT_VALUE) != sizeof(int)) if (!has)
return (false); {
//--- write value of the "ShowObjectDescr" property return has;
if (FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_OBJECT_DESCR), CHAR_VALUE) != sizeof(char)) }
return (false);
//--- successful //
return (true); // Write value of the "ScaleFix" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALEFIX), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "ScaleFix_11" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALEFIX_11), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "FixedMax" property ...
has = FileWriteDouble(file_handle, ChartGetDouble(mChartID, CHART_FIXED_MAX)) == sizeof(double);
if (!has)
{
return has;
}
//
// Write value of the "FixedMin" property ...
has = FileWriteDouble(file_handle, ChartGetDouble(mChartID, CHART_FIXED_MIN)) == sizeof(double);
if (!has)
{
return has;
}
//
// Write the "ScalePPB" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SCALE_PT_PER_BAR), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "PointsPerBar" property ...
has = FileWriteDouble(file_handle, ChartGetDouble(mChartID, CHART_POINTS_PER_BAR)) == sizeof(double);
if (!has)
{
return has;
}
//
// Write value of the "ShowOHLC" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_OHLC), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "ShowLineBid" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_BID_LINE), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "ShowLineAsk" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_ASK_LINE), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "ShowLastLine" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_LAST_LINE), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "ShowPeriodSep" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_PERIOD_SEP), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "ShowGrid" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_GRID), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
// Write value of the "ShowVolumes" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_VOLUMES), INT_VALUE) == sizeof(int);
if (!has)
{
return has;
}
//
// Write value of the "ShowObjectDescr" property ...
has = FileWriteInteger(file_handle, (int)ChartGetInteger(mChartID, CHART_SHOW_OBJECT_DESCR), CHAR_VALUE) == sizeof(char);
if (!has)
{
return has;
}
//
return has;
}
/**
* Load Specified Chart File ...
*
* @param file_handle: int ...
*
* @return ( bool )
*/
bool Load(const int file_handle)
{
//
string work_str;
int work_int;
//
bool has = false;
//
// Validate ...
if (file_handle == INVALID_HANDLE || mChartID == -1)
{
return has;
}
//
// Read and checking start marker - 0xFFFFFFFFFFFFFFFF ...
if (FileReadLong(file_handle) != -1)
return has;
//
// Read and checking chart type ...
if (FileReadInteger(file_handle, INT_VALUE) != Type())
return has;
//
// Read chart symbol ...
work_int = FileReadInteger(file_handle);
if (work_int != 0)
{
work_str = FileReadString(file_handle, work_int);
}
else
{
work_str = "";
}
//
// Read chart period ...
work_int = FileReadInteger(file_handle);
SetSymbolPeriod(work_str, (ENUM_TIMEFRAMES)work_int);
//
// Read value of the "Mode" property ...
has = ChartSetInteger(mChartID, CHART_MODE, FileReadInteger(file_handle, INT_VALUE));
if (!has)
{
return has;
}
//
// Read value of the "Foreground" property ...
has = ChartSetInteger(mChartID, CHART_FOREGROUND, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Read value of the "Shift" property ...
has = ChartSetInteger(mChartID, CHART_SHIFT, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Read value of the "ShiftSize" property ...
has = ChartSetInteger(mChartID, CHART_SHIFT, FileReadInteger(file_handle, INT_VALUE));
if (!has)
{
return has;
}
//
// Read value of the "AutoScroll" property ...
has = ChartSetInteger(mChartID, CHART_AUTOSCROLL, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Read value of the "Scale" property ...
has = ChartSetInteger(mChartID, CHART_SCALE, FileReadInteger(file_handle, INT_VALUE));
if (!has)
{
return has;
}
//
// Read value of the "ScaleFix" property ...
has = ChartSetInteger(mChartID, CHART_SCALEFIX, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Read value of the "ScaleFix_11" property ...
has = ChartSetInteger(mChartID, CHART_SCALEFIX_11, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "FixedMax" property ...
has = ChartSetDouble(mChartID, CHART_FIXED_MAX, FileReadDatetime(file_handle));
if (!has)
{
return has;
}
//
// Rread value of the "FixedMin" property ...
has = ChartSetDouble(mChartID, CHART_FIXED_MIN, FileReadDatetime(file_handle));
if (!has)
{
return has;
}
//
// Rread value of the "ScalePPB" property ...
has = ChartSetInteger(mChartID, CHART_SCALE_PT_PER_BAR, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "PointsPerBar" property ...
has = ChartSetDouble(mChartID, CHART_POINTS_PER_BAR, FileReadDatetime(file_handle));
if (!has)
{
return has;
}
//
// Rread value of the "ShowOHLC" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_OHLC, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "ShowLineBid" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_BID_LINE, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "ShowLineAsk" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_ASK_LINE, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "ShowLastLine" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_LAST_LINE, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "ShowPeriodSep" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_PERIOD_SEP, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "ShowGrid" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_GRID, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "ShowVolumes" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_VOLUMES, FileReadInteger(file_handle, INT_VALUE));
if (!has)
{
return has;
}
//
// Rread value of the "ShowObjectDescr" property ...
has = ChartSetInteger(mChartID, CHART_SHOW_OBJECT_DESCR, FileReadInteger(file_handle, CHAR_VALUE));
if (!has)
{
return has;
}
//
return has;
} }
// //
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6
View File
@@ -153,6 +153,12 @@ int OnInit()
// //
// Setting All Inputs to Expert Adviser Class ... // Setting All Inputs to Expert Adviser Class ...
//
// Common ...
eaExpert.eaMagicNumber = eaMagicNumber;
eaExpert.eaSlippage = eaSlippage;
eaExpert.eaLogSuffix = eaTag;
// //
// Symbols ... // Symbols ...
eaExpert.eaSymbolConfiguration = eaSymbolConfiguration; eaExpert.eaSymbolConfiguration = eaSymbolConfiguration;