老王吧 发表于 2016-4-22 10:15:20

3LineBreak.mq4



//+------------------------------------------------------------------+
//|                                                   3LineBreak.mq4 |
//|                               Copyright © 2004, Poul_Trade_Forum |
//|                                                         Aborigen |
//|                                          http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
#property copyright "Poul Trade Forum"
#property link      "http://forex.kbpauk.ru/"
#property indicator_chart_window
#property indicator_buffers 2

//---- input parameters
extern int Lines_Break=3;
//---- buffers
double HighBuffer[];
double LowBuffer[];
double VALUE1,VALUE2,Swing=1,OLDSwing;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   string short_name;
//---- indicator line
   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2,Blue);
   SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2,Red);

   SetIndexBuffer(0,HighBuffer);
   SetIndexBuffer(1,LowBuffer);

   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);

//---- name for DataWindow and indicator subwindow label
   short_name="3LineBreak";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

//----
   SetIndexDrawBegin(0,10);
   SetIndexDrawBegin(1,10);
//----

   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                     |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here

//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int    counted_bars=IndicatorCounted(),i,shift;
   

//---- TODO: add your code here
if (counted_bars==0) counted_bars=Lines_Break+1;
i=(Bars-counted_bars);

for (shift=i; shift>=0;shift--)
{

OLDSwing=Swing;

VALUE1=High;
VALUE2= Low;
if (OLDSwing==1 &&Low<VALUE2) Swing=-1;
if (OLDSwing==-1 && High>VALUE1 ) Swing=1;

if (Swing==1)
{ HighBuffer=High; LowBuffer=Low; }

if (Swing==-1)
{ LowBuffer=High; HighBuffer=Low; }


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



fyiwtkeh4972 发表于 2018-9-23 14:21:45

学习了,谢谢分享、、、

28633 发表于 2020-2-19 15:06:22

前排支持下

wudixiao8h 发表于 2020-3-20 22:28:45

前排支持下

小江 发表于 2020-6-15 21:54:43

LZ说的很不错

外汇比赛网 发表于 2020-7-11 17:42:51

帮你顶下哈!!

金凝钰银 发表于 2020-7-17 10:06:07

帮你顶下哈!!

老张说汇 发表于 2020-7-20 10:06:01

帮你顶下哈!!

天魔心842 发表于 2020-7-27 14:26:54

谢谢楼主分享

曾祥平 发表于 2020-8-14 22:48:30

学习了,不错
页: [1] 2
查看完整版本: 3LineBreak.mq4