3FoldTradingHours_v1

Author: cubesteak
3FoldTradingHours_v1
0 Views
0 Downloads
0 Favorites
3FoldTradingHours_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                            3FoldTradingHours.mq4 |
//|                                                        cubesteak |
//|                                         http://www.cubesteak.net |
//+------------------------------------------------------------------+
#property copyright "cubesteak"
#property link      "http://www.cubesteak.net"

#property indicator_chart_window     

//---- input parameters
extern int       FromHourTrade1=-1;
extern int       ToHourTrade1=-1;
extern int       FromHourTrade2=-1;
extern int       ToHourTrade2=-1;
extern int       FromHourTrade3=-1;
extern int       ToHourTrade3=-1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   
//----
   
int a,b,c;
bool UseHourTrade = true;

if (UseHourTrade)
{

   if (
         FromHourTrade1==-1 &&
         ToHourTrade1==-1 &&
         FromHourTrade2==-1 &&
         ToHourTrade2==-1 &&
         FromHourTrade3==-1 &&
         ToHourTrade3==-1 
      ) Comment("Trading Hours Not Set");
      else
      {

      int now = Hour();
      if (

            ( (now>=FromHourTrade1) ) &&
            ( (now<=ToHourTrade1) )
         
         ) a=1;

   
      if (

            ( (now>=FromHourTrade2) ) &&
            ( (now<=ToHourTrade2) )
         
         ) b=1;


      if (

            ( (now>=FromHourTrade3) ) &&
            ( (now<=ToHourTrade3) )
         
         ) c=1;

      if (
            (a!=1) &&
            (b!=1) &&
            (c!=1)
         )
      {
      Comment(
      "\n"," ^^^^^^^^^^^^^^^^^^^^",
      "\n","   * NON-TRADING HOURS * ",
      "\n"," ^^^^^^^^^^^^^^^^^^^^");
      }
      else    Comment(
      "\n"," ^^^^^^^^^^^^^^^^",
      "\n","   * TRADING HOURS * ",
      "\n"," ^^^^^^^^^^^^^^^^");
      }
}

   
//----
   return(0);
  }
//+------------------------------------------------------------------+

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 ---