Author: Copyright � 2010, MetaQuotes Software Corp.
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
buy_deal
//+------------------------------------------------------------------+
//|                                                     buy_deal.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_minimum -1
#property indicator_maximum 1
#property indicator_buffers 1
#property indicator_color1 Blue

extern double sl=0.0035;
extern double tp=0.007;
//---- buffers
double buy_deal[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,buy_deal);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i;
   int counted_bars=IndicatorCounted();
//----
   i=Bars-counted_bars-1;
   
   while(buy(i)!=0)
    {
     buy_deal[i]=buy(i);
     i--;
    }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
int buy(int i)
 {
  int j;
  for (j=i;j>=0;j--)
   {
    if (Open[i]-Low[j]>=sl)
     return(-1);
    if (High[j]-Open[i]>=tp)
     return(1);
   }
  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 ---