//+------------------------------------------------------------------+ //| two lines.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //| Made/Modified by Alejandro Galindo | //| | //| | //| if this work/modification is helpful to you | //| send me a PayPal donation to ag@elcactus.com | //| any help is apreciated :) | //| Thanks. | //+-------------------------------------------------------------------+ #property copyright "Copyright © 2005. Alejandro Galindo" #property link "http://tradingstuff.pisem.net" #property indicator_chart_window extern int OpenTimeHr=9; extern int OpenTimeMin=30; extern int CloseTimeHr=14; extern int CloseTimeMin=30; extern int CountBars=500; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int shift, NumBars=500; double CloseTime,OpenTime; if (Bars<CountBars) { NumBars=Bars-1; } else { NumBars=CountBars; } for (shift=Bars-1;shift>=0;shift--) { OpenTime=StrToTime(TimeDay(Time[shift])+" "+OpenTimeHr+":"+OpenTimeMin); CloseTime=StrToTime(TimeDay(Time[shift])+" "+CloseTimeHr+":"+CloseTimeMin); if (TimeHour(Time[shift])== OpenTimeHr && TimeMinute(Time[shift])==OpenTimeMin) { if(ObjectFind("OpenTime"+shift) != 0) { ObjectCreate("OpenTime"+shift, OBJ_VLINE, 0, Time[shift], 0); ObjectSet("OpenTime"+shift, OBJPROP_STYLE, STYLE_SOLID); ObjectSet("OpenTime"+shift, OBJPROP_COLOR, Blue); } } if (TimeHour(Time[shift])== CloseTimeHr && TimeMinute(Time[shift])==CloseTimeMin) { if(ObjectFind("CloseTime"+shift) != 0) { ObjectCreate("CloseTime"+shift, OBJ_VLINE, 0, Time[shift], 0); ObjectSet("CloseTime"+shift, OBJPROP_STYLE, STYLE_SOLID); ObjectSet("CloseTime"+shift, OBJPROP_COLOR, Red); } } } return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: