FREENOTE
Sign up
Login
New paste
Home
Trending
Archive
English
English
Sign up
Login
New Paste
Browse
//+------------------------------------------------------------------+ //| Heiken Ashi ZoneTrade.mq4 | //+------------------------------------------------------------------+ /* Heiken Ashi ZoneTrade. ZoneTrade là sự kết hợp giữa Acceleration/Deceleration (AC) and Awesome Oscillator (AO) vào nến Heiken Ashi trên biểu đồ. Dựa theo cuốn sách nổi tiếng "Trade in the zone" bởi Bill Williams. https://t.me/FreeCodeMQL4 */ #property copyright "Duke3D (Modify by Walter Choy)" #property link "duke3datomic@mail.ru" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 RoyalBlue #property indicator_color2 Red #property indicator_color3 Gray #property indicator_color4 Gray #property indicator_color5 RoyalBlue #property indicator_color6 Red #property indicator_color7 Gray #property indicator_color8 Gray #property indicator_width1 3 #property indicator_width2 3 #property indicator_width3 3 #property indicator_width4 3 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 1 #property indicator_width8 1 extern color BlueZone = RoyalBlue; extern color RedZone = Red; extern color GreyZone = Gray; double AC_0; double AC_1; double AO_0; double AO_1; string name; extern int BodyWidth = 3; extern int ShadowWidth = 1; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; double ExtMapBuffer8[]; //---- //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM, 0, BodyWidth, BlueZone); SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(1,DRAW_HISTOGRAM, 0, BodyWidth, RedZone); SetIndexBuffer(1, ExtMapBuffer2); SetIndexStyle(2,DRAW_HISTOGRAM, 0, BodyWidth, GreyZone); SetIndexBuffer(2, ExtMapBuffer3); SetIndexStyle(3,DRAW_HISTOGRAM, 0, BodyWidth, GreyZone); SetIndexBuffer(3, ExtMapBuffer4); SetIndexStyle(4,DRAW_HISTOGRAM, 0, ShadowWidth, BlueZone); SetIndexBuffer(4, ExtMapBuffer5); SetIndexStyle(5,DRAW_HISTOGRAM, 0, ShadowWidth, RedZone); SetIndexBuffer(5, ExtMapBuffer6); SetIndexStyle(6,DRAW_HISTOGRAM, 0, ShadowWidth, GreyZone); SetIndexBuffer(6, ExtMapBuffer7); SetIndexStyle(7,DRAW_HISTOGRAM, 0, ShadowWidth, GreyZone); SetIndexBuffer(7, ExtMapBuffer8); SetIndexEmptyValue(0, 0.0); SetIndexEmptyValue(1, 0.0); SetIndexEmptyValue(2, 0.0); SetIndexEmptyValue(3, 0.0); SetIndexEmptyValue(4, 0.0); SetIndexEmptyValue(5, 0.0); SetIndexEmptyValue(6, 0.0); SetIndexEmptyValue(7, 0.0); SetIndexDrawBegin(0,10); SetIndexDrawBegin(1,10); SetIndexDrawBegin(2,10); SetIndexDrawBegin(3,10); SetIndexDrawBegin(4,10); SetIndexDrawBegin(5,10); SetIndexDrawBegin(6,10); SetIndexDrawBegin(7,10); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i, limit; double ZTOpen, ZTHigh, ZTLow, ZTClose; if(counted_bars > 0) counted_bars--; i = Bars - counted_bars - 1; while(i>=0) { ZTOpen=(ExtMapBuffer1[i+1]+ExtMapBuffer2[i+1]+ExtMapBuffer3[i+1]+ExtMapBuffer4[i+1])/2; ZTClose=(Open[i]+High[i]+Low[i]+Close[i])/4; ZTHigh=MathMax(High[i], MathMax(ZTOpen, ZTClose)); ZTLow=MathMin(Low[i], MathMin(ZTOpen, ZTClose)); //=================================================================================================================== if(IndAC(i)==1 && IndAO(i)==1) // ??????? ???? { if(ZTOpen>ZTClose) // bear { ExtMapBuffer1[i] = ZTOpen; ExtMapBuffer2[i] = ZTClose; } if(ZTOpen<ZTClose) // bull { ExtMapBuffer1[i] = ZTClose; ExtMapBuffer2[i] = ZTOpen; } ExtMapBuffer5[i] = ZTHigh; ExtMapBuffer6[i] = ZTLow; ExtMapBuffer3[i] = 0.0; ExtMapBuffer4[i] = 0.0; ExtMapBuffer7[i] = 0.0; ExtMapBuffer8[i] = 0.0; } //=================================================================================================================== if(IndAC(i)==2 && IndAO(i)==2) { if(ZTOpen>ZTClose) // bear { ExtMapBuffer1[i] = ZTClose; ExtMapBuffer2[i] = ZTOpen; } if(ZTOpen<ZTClose) // bull { ExtMapBuffer1[i] = ZTOpen; ExtMapBuffer2[i] = ZTClose; } ExtMapBuffer5[i] = ZTLow; ExtMapBuffer6[i] = ZTHigh; ExtMapBuffer3[i] = 0.0; ExtMapBuffer4[i] = 0.0; ExtMapBuffer7[i] = 0.0; ExtMapBuffer8[i] = 0.0; } //=================================================================================================================== if(IndAC(i)==1 && IndAO(i)==2) // ????? ???? { if(ZTOpen>ZTClose) // bear { ExtMapBuffer3[i] = ZTOpen; ExtMapBuffer4[i] = ZTClose; } if(ZTOpen<ZTClose) // bull { ExtMapBuffer3[i] = ZTClose; ExtMapBuffer4[i] = ZTOpen; } ExtMapBuffer7[i] = ZTHigh; ExtMapBuffer8[i] = ZTLow; ExtMapBuffer1[i] = 0.0; ExtMapBuffer2[i] = 0.0; ExtMapBuffer5[i] = 0.0; ExtMapBuffer6[i] = 0.0; } //=================================================================================================================== if(IndAC(i)==2 && IndAO(i)==1) // ????? ???? { if(ZTOpen>ZTClose) // bear { ExtMapBuffer3[i] = ZTClose; ExtMapBuffer4[i] = ZTOpen; } if(ZTOpen<ZTClose) // bull { ExtMapBuffer3[i] = ZTOpen; ExtMapBuffer4[i] = ZTClose; } ExtMapBuffer7[i] = ZTLow; ExtMapBuffer8[i] = ZTHigh; ExtMapBuffer1[i] = 0.0; ExtMapBuffer2[i] = 0.0; ExtMapBuffer5[i] = 0.0; ExtMapBuffer6[i] = 0.0; } i--; } //=================================================================================================================== return(0); } //=================================================================================================================== int IndAC(int Shift) { int DirectionAC = 1; AC_0 = iAC(Symbol(),0,Shift); AC_1 = iAC(Symbol(),0,Shift+1); if(AC_0>AC_1) {DirectionAC = 1;} if(AC_0<AC_1) {DirectionAC = 2;} return(DirectionAC); } //=================================================================================================================== int IndAO(int Shift) { int DirectionAO = 1; AO_0 = iAO(Symbol(),0,Shift); AO_1 = iAO(Symbol(),0,Shift+1); if(AO_0>AO_1) {DirectionAO = 1;} if(AO_0<AO_1) {DirectionAO = 2;} return(DirectionAO); } //===================================================================================================================
Paste Settings
Paste Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax Highlighting :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Paste Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create New Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English
Do you like cookies?
🍪 We use cookies to ensure you get the best experience on our website.
Learn more
I agree