比如平台7点是 重要时刻
或者
if( Hour()==Hour_For_Long_Entry && Minute()>=Minute_For_Long_Entry && Minute()=Minute_For_Long_Entry && Minute()=Minute_For_Long_Entry && IsTradeAllowed()==true)
{
if(Place_Buy == true)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,"WNV Buy",MagicNumber,0,Blue);
Place_Buy=false;
{
if(IsTradeAllowed()==false) Print("Trade not allowed");
}
return(0);
}
}
-----------------------------------------
上次内容如下
extern string StartTime = "06:00"; // time for start of price establishment window
extern string EndTime = "09:14"; // time for end of price establishment window
extern string SessionEndTime= "02:00"; // end of daily session; tomorrow is another day!
extern int MinBoxSizeInPips = 15; //
tBoxStart = StrToTime(TimeToStr(now,TIME_DATE) + " " + StartTime);
tBoxEnd = StrToTime(TimeToStr(now,TIME_DATE) + " " + EndTime);
if (boxExtent >= MinBoxSizeInPips * pip) { // box OK
drawBox (boxName,tBoxStart,boxLow,tBoxEnd,boxHigh,BoxColorOK,1, STYLE_SOLID, true);
DrawLbl(objPrefix+"Lbl-"+TimeToStr(now,TIME_DATE)+"-"+StartTime+"-"+EndTime, DoubleToStr(boxExtent/pip,0)+"p", tBoxStart+(tBoxEnd-tBoxStart)/2,boxLow, 12, "Arial Black", LevelColor, 3);
}
---------------------------------
例子定时 如上 小段
再用 TraderHour 控制 是否要进行
int now = TimeHour(Time[0])*100 + TimeMinute(Time[0]);
prev_TradeHour = TradeHour;
if ( (TradingStartHHMM = TradingStartHHMM && now TradingEndHHMM && (now >= TradingStartHHMM || now < TradingEndHHMM)) ) {
TradeHour = true;
} else {
TradeHour = false;
}
|