Author: Copyright � 2009, MetaQuotes Software Corp.
Price Data Components
Series array that contains open prices of each bar
0 Views
0 Downloads
0 Favorites
signal
//+------------------------------------------------------------------+
//|                                                      signal .mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//---- indicator settings 
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_minimum 0
#property indicator_maximum 1



//---- indicator parameters  
 

extern int win = 0;
extern int price.x.offset= 47 ; 
extern int price.y.offset= 30 ; 


extern int   myFontSize       = 14;


extern string noteTimeNY = " 14:00 server time = 05:00 mst" ; 
extern string noteTimeAU = " 23:00 server time = 14:00 mst" ; 
extern string noteTimeLD = " 09:00 server time = 00:00 mst" ; 


extern string myHHMM       = "13:00"; // 05:00 am pst = 14:00 server time 
extern string myMessage    = "NY" ; 


extern string Buy_Message  = "BUY SIGNAL" ;
extern string Wait_Message = "WAIT FOR SIGNAL" ;
extern string Sell_Message = "SELL SIGNAL" ;
extern string Rdy_Message  = "READY TO ENTER" ;

extern color Buy_color = Lime;
extern color Wait_color = Yellow;
extern color Sell_color = Red;
extern color Rdy_color = Aqua;

//---- indicator buffers 



//---- buffers


string tMessage , oldmsg = "" ; 
//+--------- TRO MODIFICATION ---------------------------------------+ 
string symbol, tChartPeriod,  tShortName ;  
int    digits, period  ; 

datetime Trigger ;

int OldBars = -1 ;

color tColor = Yellow ;
 

color ClOpColor;

double H1_open, H1_close, open, close, diff, spread, DailyOpen ;
  
//+------------------------------------------------------------------+ 
int init() 
  { 
   period       = Period() ;     
//   tChartPeriod =  TimeFrameToString(period) ;
   symbol       =  Symbol() ;
   digits       =  Digits ;   

   tShortName = "tw"+ symbol + tChartPeriod  ;

   return(0); 
  } 

int deinit() 
{ 

   
   ObjectDelete("TRAIN30");
   ObjectDelete("TRAIN29");
   ObjectDelete("TRAIN29B");
   ObjectDelete("TRAIN31");
   ObjectDelete("TRAIN32");
   ObjectDelete("TRAIN34");   
   
   ObjectDelete("TRAIN30");
   ObjectDelete("TRAIN29");
   ObjectDelete("TRAIN29B");
   ObjectDelete("TRAIN31");
   ObjectDelete("TRAIN32");
   ObjectDelete("TRAIN34");   
}  
 
//+------------------------------------------------------------------+ 
int start() 
  { 
   
DoDailyOpen() ;   
   
//   open     = iOpen(symbol,PERIOD_D1,0);
   close    = Close[0];   
   open     = Open[0];
   
   H1_open  = iOpen(symbol,PERIOD_H1,0);
//   H1_close = iClose(symbol,PERIOD_H1,0);  

while(true)
{

if( close > open && close > DailyOpen && close > H1_open ) { tMessage = Buy_Message  ; ClOpColor = Buy_color  ; break ; }

if( close < open && close < DailyOpen && close < H1_open ) { tMessage = Sell_Message ; ClOpColor = Sell_color ; break ; } 
 
tMessage = Wait_Message ; ClOpColor = Wait_color ; 

break;

} // while


oldmsg =  tMessage ;

//+------------------------------------------------------------------+  
                    
   ObjectCreate("TRAIN31", OBJ_LABEL, win, 0, 0);//HiLow LABEL
   ObjectSetText("TRAIN31",tMessage, myFontSize , "Segoe Print", ClOpColor );
   ObjectSet("TRAIN31", OBJPROP_CORNER, 0);
   ObjectSet("TRAIN31", OBJPROP_XDISTANCE, price.x.offset); 
   ObjectSet("TRAIN31", OBJPROP_YDISTANCE, price.y.offset); 


 string note2 = "Default Font Color";
 color  twFontColor              = DimGray;
 string note3                  = "Font Size";
 int twFontSize                  = 8;
 string note4                  = "Font Type";
 string twFontType               = "Verdana"; // Tahoma Courier
string RAN953 =  ""  ;   
string tObjName03 = "TROTW"  ; 
    
   ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL
   ObjectSetText(tObjName03, RAN953 , twFontSize ,  twFontType,  twFontColor );
   ObjectSet(tObjName03, OBJPROP_CORNER, 3);
   ObjectSet(tObjName03, OBJPROP_XDISTANCE,  5 );
   ObjectSet(tObjName03, OBJPROP_YDISTANCE, 10); 
//+------------------------------------------------------------------+        

   WindowRedraw();   
    
   return(0);
}

//+------------------------------------------------------------------+

void DoDailyOpen() 
{

int   yy = TimeYear(Time[0]);
int   mm = TimeMonth(Time[0]);
int   dd = TimeDay(Time[0]);  
   
string yymmddms = yy+"."+mm+"."+dd+" " + myHHMM ;
         
datetime var1 = StrToTime(yymmddms);  
   
datetime day=24*60*60;
datetime r= var1 ;

int      cd=iBarShift(NULL,0,r,FALSE);
datetime r2=r-day;

if(TimeDayOfWeek(r2)==0) r2=r2-day-day;
int cd2=iBarShift(NULL,0,r2,FALSE);

if( var1 > Time[0] ) { r = r2 ;cd = cd2 ;} // if date/time is greater than current date/time go back 1 day

DailyOpen = Open[cd] ;

}


//+------------------------------------------------------------------+ 

/*
 

Comment(

 
"DailyOpen " , DoubleToStr(DailyOpen,Digits) , "\n" ,
 

"") ; 

 
*/

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---