Author: favoritefx
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
1 Views
0 Downloads
0 Favorites
e-fisher
//+------------------------------------------------------------------+
//|                                                       fisher.mq4 |
//|                                                       favoritefx |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "favoritefx"
#property link      "http://www.metaquotes.net"

//---- input parameters

extern int    TakeProfit=50;
extern int    StopLoss=30;
extern double Lots=0.1;



//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+


int init()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
  double price;
  double stop;
  double profit;
  double RSI;
  double MARSI_Fast;
  double MARSI_Slow;

   if (AccountFreeMargin() < 1200 * Lots)
      return (0);

   //----
   if (( (OrdersTotal() == 0)))
   {
      RSI = iCustom(Symbol(),0,"TrendRSI_v1",13,8,55,0,1); //0 áóôåð

      MARSI_Fast = iCustom(Symbol(),0,"TrendRSI_v1",13,8,55,1,1); //1 áóôåð

      MARSI_Slow = iCustom(Symbol(),0,"TrendRSI_v1",13,8,55,2,1); //2 áóôåð


      if (RSI<MARSI_Slow )
      {

         stop   = NormalizeDouble(Ask - StopLoss   * Point, Digits);
         profit = NormalizeDouble(Ask + TakeProfit * Point, Digits);
         OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, stop, profit, NULL, 0, 0, Green);
      }
        if (RSI>MARSI_Slow)
      {

         stop   = NormalizeDouble(Bid + StopLoss   * Point, Digits);
         profit = NormalizeDouble(Bid - TakeProfit * Point, Digits);
         OrderSend(Symbol(),OP_SELL,Lots,Bid,3,stop,profit,NULL,0,0,Green);
         //Print(AccountBalance());
      }
   }
//----
   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 ---