想要分享其实不容易,不是贴出来就能用的那么简单。
在学习mt4设计之初,开发了很多公共的辅助库类函数。
像这个。
[C++] 纯文本查看 复制代码class KCoder
{
private:
public:
string symbolDivide(string symbolInput);
bool tts(string text);
void ObjectSetPosition(int chart_ID=0,string ObjecName="Object",
int x_distance=10,
int y_distance=10,
ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER);
void ObjectSetControl(int chart_ID=0,string ObjecName="Object",
const bool selectable=false,
const bool selected=false,
const bool hiddenInList=true,
const int z_order=0);
void ObjectSetOutlook(int chart_ID=0,string ObjecName="Object",
const bool asBackground=true,
const int xSize=50,
const int ySize=20,
const color clrBackGround=clrWhite,
ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER,
const int editAlign=ALIGN_RIGHT,
const int angle=0);
int Array_Search_String(
const string &array[],// array for search
string value,// what is searched for
int count=WHOLE_ARRAY,// count of elements to search for
int startFrom=0,// starting position
int direction=MODE_ASCEND // search direction
);
int Array_Search_Time(
const datetime &array[],// array for search
datetime value, // what is searched for
int count=WHOLE_ARRAY, // count of elements to search for
int startFrom=0,// starting position
int direction=MODE_ASCEND // search direction
);
string errorPrint(int id);
double currencyRate(string Currency,int timef,int shift);
double currency_Real_Value(string Currency,int timef,int shift);
double currency_Real_Value_V2(string Currency,int timef,int i_shift,ENUM_APPLIED_PRICE applied_price=PRICE_CLOSE);
long currency_Volume(string Currency,int timef,int shift);
string currency_Compare(int period);
int currency_Compare_single(int period,int index);
string StringGetString(string Str,string startBy,string endWith);
int get_File_Size(string path);
string get_DataPath_File();
double currencyRSI(string Currency,int timef,int period,int applied_pcrice,int shift);
//change function
int str_to_currency_index(string strInput);
color symbol_to_color(string symbol);
int time_to_index(datetime TIME);
string num_To_Shape(int i,string shapeType);
string TimeFrame_to_String(int arg);
int String_to_TimeFrame(string Str);
string DoubleToStrMorePrecision(double number,int precision);
string second_To_Time(int sec);
string second_To_DigitTimer(int num);
string bool_to_string(bool bo=true,int type=0,bool upcase=false);
int weekOfYear(datetime time);
string time12To24(string timeStr);
void initAllIndicators(void);
int RGB(int red_value,int green_value,int blue_value);
bool CompareDoubles(double number1,double number2);
bool trend(int i,const double &Arry[]);
string uninitializedReason(int reason);
void playSound(string file);
bool inTradeDay();
void openLink(string path,int nCmdShow=1);
void debug_Array_Double(int index,const double &array[]);
//useful tools
bool save_Screen(int width,int hight);
bool save_CurrentScreen(int width=1300,int hight=500);
double arrowSeperator(int seperator);
};//
我的所有程序都交差引用了多重的这类自定义类函数。
还有好多公共变量。
例如下面这个
[C++] 纯文本查看 复制代码string font_monospace[]={"Bitstream Vera Sans Mono","Clean","Courier","Fixed","Gothic",
"Lucidatypewriter","Mincho","Nil","Terminal","Nimbus",
"Mono L","longzhoufeng"};
这个是一个自己收集的相同宽度字体的array。当然是为了在屏幕显示的文字美观整齐。
因为我的代码里都引用了很多这类自定义库。所以要想在别人机器上使用需要重新调试。
目前在学习整理一些外汇基础知识。实在没有时间做这些。
|