ytg_Speed_MA_ea

Author: YURIY TOKMAN
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
0 Views
0 Downloads
0 Favorites
ytg_Speed_MA_ea
//+------------------------------------------------------------------+
//|                                              ytg_Speed_MA_ea.mq4 |
//|                                                     YURIY TOKMAN |
//|                                            yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "YURIY TOKMAN"
#property link      "yuriytokman@gmail.com"

extern int  PeriodMA     = 13;
extern int  Porog        = 10 ;
extern int  shift        = 1;
extern bool Revers       = false;
extern int  TP           = 500;
extern int  SL           = 490;
//+------------------------------------------------------------------+
int start()
  {
//----
   double MA_bar0 =iMA(NULL,0,PeriodMA,0,0,0,shift);
   double MA_bar1 =iMA(NULL,0,PeriodMA,0,0,0,shift+1);
   double Delta = MA_bar0-MA_bar1;   
   bool buy = false, sell = false;
   if(Delta>Porog*Point){if(Revers)sell = true;else buy = true;}   
   if(Delta<-Porog*Point){if(Revers)buy = true;else sell = true;}
   
   if(OrdersTotal()<1){
   if(buy)OrderSend(Symbol(),OP_BUY,0.1,Ask,50,Bid-SL*Point,Ask+TP*Point);
   if(sell)OrderSend(Symbol(),OP_SELL,0.1,Bid,50,Ask+SL*Point,Bid-TP*Point);}   
//----
   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 ---