_HPCS_Inter5_MT4_EA_V01_WE

Author: Copyright 2021, MetaQuotes Software Corp.
Price Data Components
Series array that contains open time of each bar
Orders Execution
It automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites
_HPCS_Inter5_MT4_EA_V01_WE
//+------------------------------------------------------------------+
//|                                   _HPCS_Inter5_MT4_EA_V01_WE.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property script_show_inputs
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+

input int ii_stoploss = 10;
input int ii_TakeProfit = 10;

int OnInit()
  {
//---
      
      int li_ticket,li_factor = 1;
   double ld_stoploss,ld_Takeprofit;
   
   if(Digits ==5 || Digits == 3)
   { li_factor = 10;}
   
   ld_Takeprofit = Ask + ii_TakeProfit*Point()*li_factor;
   ld_stoploss = Ask - ii_stoploss*Point()*li_factor;
   
   if(ld_stoploss > (Bid - MarketInfo(_Symbol,MODE_STOPLEVEL )*Point()))
   {
      ld_stoploss = (Bid - MarketInfo(_Symbol,MODE_STOPLEVEL )*Point());
   } 
   
      if(Close[5] > Close[1])
      {
         li_ticket = OrderSend(_Symbol,OP_BUY,1,Ask,10,ld_stoploss,ld_Takeprofit,NULL,2233);
         if(li_ticket < 0)
         {
            Print("Order not placed with Error: ",GetLastError());
         }
         if(OrderSelect(li_ticket,SELECT_BY_TICKET,MODE_TRADES))
         {
            OrderPrint();
            Print("Order Open Time is: ",OrderOpenTime());
         }
      }
      
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//--- 
   
  }
//+------------------------------------------------------------------+

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