绘制日内高低点及开始时间指标 paromon.mq4-MT4指标-峰汇在线
诚信为本
量力而为
当前位置:峰汇在线 > MetaTrader 4 > MT4指标 > 正文

绘制日内高低点及开始时间指标 paromon.mq4

paromon 指标绘制一天的开始及高点和低点。

图表:paromon 指标

源码:

//+------------------------------------------------------------------+
//|                                                      paromon.mq4 |
//|                                                          Danilla |
//+------------------------------------------------------------------+
#property copyright "Danilla"
#property link   "http://www.125808047.com"

#property indicator_chart_window

int DayOffset = 7200; // 2 hours
int DayExtremumsOffset = 3600;
int DayExtremumsOffsetStartTime = 36000; //10:00 AM
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{ 
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); 

SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 0, Red);
ObjectCreate("lowline", OBJ_HLINE, 0, 0, 0);
ObjectCreate("highline", OBJ_HLINE, 0, 0, 0);
ObjectCreate("avline", OBJ_HLINE, 0, 0, 0);
ObjectSet("avline", OBJPROP_COLOR, Blue);
ObjectCreate("Day_start", OBJ_VLINE, 0, 0, 0);
Comment("www.125808047.com");
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
   void OnDeinit(const int reason)
{
ObjectDelete("lowline");
ObjectDelete("highline");
ObjectDelete("avline");
ObjectDelete("Day_start");
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
int counted_bars=IndicatorCounted();
int limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;

double lowprice=0, highprice=0, avprice=0;
int shift=0, barsinday=0;
int DayExtremumsBarOffset = 0;
while (DayOfWeek()==TimeDayOfWeek(Time[barsinday]+DayOffset)) {
barsinday++;
}
barsinday--;

if (CurTime () % (60*60*24) > (10*60*60) )
{
while ((Time[0]-Time[DayExtremumsBarOffset]<DayExtremumsOffset) && (Time[DayExtremumsBarOffset]% (60*60*24)>(10*60*60))) {
DayExtremumsBarOffset++;
}
DayExtremumsBarOffset--;
}

ObjectMove("Day_start", 0, Time[barsinday], 0);

shift=Lowest(NULL, 0, MODE_LOW, barsinday-DayExtremumsBarOffset, DayExtremumsBarOffset);
lowprice=Low[shift];
ObjectMove("lowline", 0, Time[0], lowprice);

shift=Highest(NULL, 0, MODE_HIGH, barsinday-DayExtremumsBarOffset, DayExtremumsBarOffset);
highprice=High[shift];
ObjectMove("highline",0, Time[0], highprice);

avprice=(highprice+lowprice)/2;
ObjectMove("avline", 0, Time[0], avprice);

Comment("\n","Paramon\'s day: Corridor ", (highprice-lowprice)*MathPow(10, MarketInfo(Symbol(), MODE_DIGITS)), " points \n");
return(rates_total);
}
//+------------------------------------------------------------------+
打赏
版权所有转载请注明标题及链接:峰汇在线 » 绘制日内高低点及开始时间指标 paromon.mq4
上一篇:
下一篇:
分享到: 更多 (0)

如您觉得此文不错请扫码打赏!

支付宝扫一扫打赏

微信扫一扫打赏