投资者咨询:模型代码的编写 (文华财经WH6赢顺V6.7)
来源:文华财经 日期:2019-5-10 8:28
技术人员回复
日期:2019-5-10 8:34
投资者咨询:模型代码的编写 (文华财经WH6赢顺V6.7)
来源:文华财经 日期:2019-5-10 8:28
这个是我查到的MT4指标源码
//+------------------------------------------------------------------+
//| MarketProfile.mq4 |
//| Copyright � 2010, EarnForex.com |
//| http://www.cxh99.com/ |
//+------------------------------------------------------------------+
#property copyright "www.cxh99.com"
#property link "www.cxh99.com"
/*
Displays the Market Profile indicator for the daily trading sessions.
Should be attached to M5, M15 or M30 timeframes. M30 is recommended.
Designed for standard currency pairs. May work incorrectly with very exotic pairs, CFDs or commodities.
Be careful: it will delete all rectangle objects on the chart upon deinitialization.
*/
#property indicator_chart_window
extern datetime StartFromDate = D''
extern bool StartFromToday = true;
extern int DaysToCount = 2; // Number of days for which to count the Market Profile
extern int ColorScheme = 0; // 0 - Blue to Red, 1 - Red to Green, 2 - Green to Blue
extern color MedianColor = White;
extern color ValueAreaColor = White;
int DigitsM; // Amount of digits normalized for standard 4 and 2 digits after dot
datetime StartDate; // Will hold either StartFromDate or Time[0]
double onetick; // One normalized pip
int SecondsInPeriod; // Will hold calculated amount of seconds in the selected timeframe period
bool FirstRunDone = false; // If true - OnCalculate() was already executed once
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName("MarketProfile");
// Normalizing the digits to standard 4- and 2-digit quotes
if (Digits == 5) DigitsM = 4;
else if (Digits == 3) DigitsM = 2;
else DigitsM = Digits;
if (Period() == PERIOD_M30) SecondsInPeriod = 1800;
if (Period() == PERIOD_M15) SecondsInPeriod = 900;
if (Period() == PERIOD_M5) SecondsInPeriod = 300;
onetick = NormalizeDouble(1 / (MathPow(10, DigitsM)), DigitsM);
}