Cara Belajar Forex Trading. Pengembalian yang tinggi membuat pasar valuta asing Forex merupakan pilihan investasi yang sangat menarik bagi beberapa orang Risiko tinggi dalam perdagangan mata uang dapat menyebabkan kerugian besar bagi pedagang berpengalaman Pelajari sejauh mungkin tentang bagaimana industri ini bekerja sebelum Anda mempertimbangkan untuk menempatkan Uang Anda dan mungkin kemeja dari punggung Anda di atas meja. Baca tentang dasar-dasar perdagangan mata uang, beserta pilihan terbaik bagi sebagian besar konsumen di Bankrate, situs terpercaya dengan banyak uang dan saran investasi. Carilah tentang penipuan yang Lazim dalam industri ini di situs Federal Trade Commission FTC Badan ini membuat peraturan untuk melindungi konsumen dari dealer yang tidak jujur yang menjanjikan segalanya dan mengirimkan zip FTC memantau industri dengan sangat ketat dan mengeluarkan update reguler mengenai perkembangan penting. Bergabunglah dengan akun praktik gratis di Situs Forex Membuat perdagangan mata uang virtual menggunakan akun praktik gratis Anda selama tiga puluh hari Terus mengikuti foll Ow pasar selama yang diperlukan bagi Anda untuk memahami apa yang Anda tahu dan apa yang Anda tidak tahu. Dapatkan tip dan trik yang dikirimkan ke kotak surat Anda oleh TopForexReview Dapatkan umpan berita atau peringatan tentang topik yang mungkin mempengaruhi mata uang yang Anda pertimbangkan untuk diperdagangkan Mulai dengan Hanya beberapa mata uang, sehingga Anda dapat melacak perubahan dan kemungkinan penyebabnya. Bergabunglah dengan satu atau dua forum pedagang forex dan diskusikan tren, masalah, dan perangkap di industri ini Ajukan pertanyaan di forum Sebagian besar pengguna ramah dan membantu pemula. Pengalaman orang lain dan kembangkan rencana permainan Anda sebelum pindah ke depan. Singkirkan sejumlah kecil uang tunai praktik nyata selama periode satu bulan Gunakan uang yang telah Anda setujui untuk pendapatan discretionary seperti penghematan dari kopi pagi Anda, dapatkan reguler, bukan Latte dan simpan tabungannya, makan siang selama satu bulan Anda harus mengemasi makan siang atau membuka toples koin Anda dan memasukkan uang tunai ke setengah tidak semuanya di pusat perubahan bahan makanan lokal Anda. Pilih arus yang memiliki reputasi baik. Y situs perdagangan atau broker, setelah Anda mengevaluasi rekomendasi dari pedagang lain dan menginvestigasi mereka di situs FTC Cobalah tetap berpegang pada anggaran Anda dan rencana permainan yang Anda buat saat berlatih. Keajaiban Forex Dapatkan 600 per tahun. rader membuat pertumbuhan tahunan yang efektif dari 10 840.Malcolm Rees Bulan lalu Moneyweb melaporkan skema investasi, NaxaInvest yang menawarkan pengembalian investor 2 hari, seolah-olah melalui perdagangan valuta asing. Setelah mengikuti laporan tersebut, Financial Services Board FSB dengan cepat mengeluarkan sebuah pernyataan peringatan. Investor untuk menghindari skema itu karena bukan penyedia layanan keuangan yang berwenang. Secara mengejutkan, para pendukung forex telah meningkatkan pembelaan klaim Naxa yang menghasilkan lebih dari 600 hal yang dimungkinkan melalui perdagangan mata uang. Salah satu pakar forex tersebut adalah FSB-licensed Johan van As. Para trader forex yang sukses bisa melakukan jauh lebih baik daripada 2 keuntungan per hari yang ditawarkan oleh skema ini, dia mengklaim. Melalui perusahaannya ForexMasters Van As menawarkan kepada klien three-da Y program pelatihan forex dari rumahnya, dengan biaya R10 000. Biaya yang lumayan, mungkin, tapi tidak jika jenis pengembalian Van Seperti klaim untuk dapat membantu kliennya mencapai adalah mungkin. Dalam membela klaimnya, Van As Telah menyediakan Moneyweb dengan prospektus PrivateFX sebuah program forex yang dikelola secara pribadi yang mengklaim telah menghasilkan imbal hasil 716 yang ditambah dalam 14 bulan Dia juga mengklaim bahwa guru forex internasional Greg Secker mengenakan biaya R25 000 untuk dua hari pelatihan dan tiga jam pencadangan lewat telepon, Sebagai perbandingan. Namun, Van As memperingatkan perusahaan-perusahaan yang melakukan perdagangan atas nama klien sangat berhati-hati dengan pengelolaan uang dan pengambilan risiko mereka. Oleh karena itu hasilnya lebih rendah daripada yang dapat dilakukan individu. Individu mengumpulkannya. Beberapa individu termasuk klien Van As, Adrian, Yang tampaknya telah memasukkan 337 60 ke akun tradingnya pada 11 Juli 2007, dan mengklaim telah menghasilkan keuntungan sebesar 9 133 00 dalam tiga bulan berikutnya. Itu setara dengan pertumbuhan tahunan 10 840. Moneyweb memiliki salinan o Akunnya, yang menunjukkan tingkat pertumbuhan ini akurat. Pedagang forex sukses lainnya adalah Lourens Smit, pensiunan berusia 80 tahun, klien Van As. Forex untuk pria yang tepat, jika Anda cukup berpengetahuan dengan tokoh, adalah seorang Hadiah dari surga, katanya. Saya tidak siap untuk menjamin ini tapi saya telah menghasilkan rata-rata 10 setiap bulan saya memulai dengan 8k dan saya mengerjakannya dengan jumlah yang sangat substansial beberapa ratus ribu dolar dalam waktu kurang dari setahun , Katanya. Tidak mungkin orang dengan semua pengalaman di dunia ini bisa mengajari Anda apa yang akan terjadi dalam lima menit berikutnya. Tetapi ada kecenderungan untuk mengikuti dan ada 101 metode berbeda yang dapat Anda gunakan untuk membantu Anda memutuskan apakah Ini adalah tembakan panjang atau tembakan pendek, katanya. Paduan paduan suara juara. ForexMasters sama sekali bukan suara tunggal yang menyanyikan lagu pengembalian forex yang fantastis. Sebaliknya, lagu ini nampaknya bergabung dengan paduan suara para pendukung forex yang terus mengintensifkan. Aliran twitter, Van As mempromosikan U S forex software, forexdominator yang penciptanya, Cecil Robles, mengklaim dapat memprediksi pergerakan di pasar mata uang dengan akurasi 84. Dengan membeli software, investor forex tidak perlu melakukan apa pun kecuali memutuskan berapa keuntungan yang ingin Anda dapatkan pada Kesempatan perangkat lunak memberitahu Anda dan kadang-kadang memantau perdagangan terbuka Anda. Perangkat lunak ini didasarkan pada 25.000 penelitian dan pengembangan dan ini adalah 99 dari pengangkatan berat untuk Anda, dia mengklaim. Greg Secker, juga telah melakukan putarannya di SA s Forum berbicara motivasi, termasuk di Sandton City, melalui kampanye Knowledge to Action. Harapan kurus untuk memberikan kesempatan terbesar dalam sejarah umat manusia melalui jutaan forex yang cepat telah dipertanyakan oleh Guardian Inggris yang mengungkapkan bahwa anak perusahaan perdagangannya memiliki aset bersih. Dari hanya 91 132 pada tanggal 31 Desember 2010 dan membuat kerugian selama tahun 97 13. Secara umum, platform investasi Trading Results menawarkan akses investor ke re fantastis. Belokan yang dihasilkan oleh platform AS yang menunjukkan kenaikan 931 13 sejak November 2011. Hasil akhir-akhir ini pada awalnya menjanjikan investor pertumbuhan 3 sampai 5 per bulan, namun tampaknya telah mengubah pernyataan tersebut karena diinformasikan oleh Moneyweb bahwa keuntungan yang menjanjikan melebihi 20 per tahun di atas tingkat Repo adalah ilegal menurut Undang-Undang Perlindungan Konsumen. Vista telah menerbitkan hasilnya sejak 2009 dan telah menunjukkan pertumbuhan lebih dari 60 per tahun dan tahun lalu mereka menunjukkan pertumbuhan mereka sebesar 100, kata direktur Trading Results, Pierre Van der Walt. Jadi, kami mengatakan bahwa kami menawarkan pertumbuhan 40-60 yang kurang dari itu. Sementara banyak platform perdagangan forex menawarkan gerbang yang mudah dan cepat bagi jutaan orang yang tak terhitung jumlahnya. Van As sedikit lebih terbuka mengenai risiko yang terkait. Forex trading tidak Aktivitas yang mudah, katanya, meski menambahkan bahwa itu juga tidak terlalu sulit. Anda perlu menjadi orang yang sangat disiplin, Anda harus memiliki banyak kesabaran, harus bisa bertahan dalam tekanan, harus memiliki pemahaman yang baik. G pasar dan harus memiliki metode yang baik untuk menafsirkan pergerakan pasar, katanya. Para pedagang harus merasa nyaman dengan risikonya dan harus menerima kenyataan bahwa ia dapat kehilangan uangnya jika ia membuat terlalu banyak kesalahan. Butuh waktu untuk mengembangkannya. Keterampilan dalam trading Sayangnya tidak ada perbaikan cepat atau resep yang kaya akan cepat. Namun, meski dengan peringatan Van As, kesempatan nyata bagi orang awam untuk menghasilkan keuntungan yang menurut kurcaci yang diraih oleh manajer dana profesional memang memunculkan pertanyaan yang jelas. Mengapa tidak lebih banyak manajer investasi yang menempatkan uang klien di dana Forex dan mengapa kebanyakan ahli forex yang menawarkan pelatihan tidak hanya masuk pasar sendiri untuk menghasilkan keuntungan yang mereka janjikan daripada menghabiskan waktu untuk memberikan pelatihan mahal, namun tidak mahal, mahal. Program yang mereka tawarkan. Pasar forex tidak dapat diprediksi dan mudah berubah, jadi ini berarti ada potensi menghasilkan banyak uang, namun sebaliknya juga benar, kata Chantal Robertson, hea. D Penjualan Spesialis di FNB. Pasar valas akan menjadi investasi berisiko tinggi, dan oleh karena itu, akan diharapkan untuk menghasilkan laba yang lebih baik bila dibandingkan dengan mengatakan investasi ekuitas. Namun, karena volatilitas pasar, tidak mungkin pengembalian yang sangat besar. Akan dapat dicapai secara berkelanjutan. Sebuah kata peringatan untuk semua calon investor ketika dijanjikan pengembalian yang brilian tersebut adalah mereka perlu memastikan bahwa mereka menggunakan perusahaan yang memiliki reputasi baik. Hal ini terutama berlaku saat menggunakan platform perdagangan asing. Biasanya, individu membiayai ini. Dengan cara tunjangan investasi asing mereka, yang tunduk pada persyaratan peraturan standar. Tanya Woker, mantan wakil ketua Komite Urusan Konsumen Departemen Perdagangan dan Industri juga telah memperingatkan bahwa, seperti NaxaInvest, menjanjikan tingkat pengembalian yang fantastis melalui investasi Peluang seperti Forex biasanya digunakan sebagai front untuk memancing investor masuk ke skema cepat kaya-liar seperti Ponzis dan piramida. Robertson menekankan bahwa FNB, sebagai dealer resmi, tidak menawarkan platform perdagangan spekulatif sebagai produk. Panduan Langkah demi Langkah untuk menulis Expert Advisor di MQL5 untuk Pemula. Artikel ini ditujukan untuk pemula yang ingin belajar menulis Penasehat Ahli sederhana dalam bahasa MQL5 yang baru Kami akan memulai pertama dengan menentukan apa yang kami inginkan dari penasihat ahli EA kami, dan kemudian beralih ke bagaimana kami menginginkan EA melakukannya.1 Strategi Perdagangan. Apa yang akan dilakukan EA kami. Monitor indikator tertentu, dan bila kondisi tertentu terpenuhi atau kondisi tertentu terpenuhi, maka akan melakukan perdagangan baik Short Sell atau Long Buy, tergantung kondisi saat ini yang telah terpenuhi. Di atas disebut strategi trading Before you Bisa menulis EA, terlebih dahulu anda harus mengembangkan strategi yang ingin diotomatiskan ke EA Jadi dalam kasus ini, mari kita ubah pernyataan di atas sehingga mencerminkan strategi yang ingin kita kembangkan menjadi EA. Kita akan menggunakan indikator yang disebut Moving Average dengan periode 8 Yo Anda bisa memilih periode apa saja, tapi untuk tujuan strategi kami, kami akan menggunakan 8. Kami ingin EA kami melakukan perdagangan Long Buy saat Moving Average-8 untuk kepentingan diskusi kami, saya akan menyebutnya MA - 8 meningkat ke atas dan harganya mendekati di atasnya dan akan menempatkan Short Sell saat MA-8 mengalami penurunan ke bawah dan harganya mendekati di bawahnya. Kita juga akan menggunakan indikator lain yang disebut Average Directional Movement ADX dengan periode 8 juga. Untuk membantu kita menentukan apakah pasar sedang tren atau tidak Kami melakukan ini karena kita hanya ingin memasuki perdagangan saat pasar sedang tren dan rileks saat pasar mulai, tidak ngetren Untuk mencapai ini, kita hanya akan menempatkan perdagangan kita. Beli atau Jual bila kondisi di atas terpenuhi dan nilai ADX lebih besar yaitu 22 Jika ADX lebih besar 22 tapi turun, atau ADX kurang dari 22, kita tidak akan bertransaksi, meski kondisi B sudah terpenuhi. Kita juga ingin Lindungi diri kita dengan menetapkan Stop loss 30 pips, dan untuk keuntungan kita ta Rget kami akan menargetkan keuntungan 100 pips. Kami juga ingin EA kami mencari peluang Buy Sell hanya ketika bar baru telah terbentuk dan kami juga akan memastikan kami membuka posisi Buy jika kondisi Buy terpenuhi dan kami tidak Sudah punya satu membuka, dan buka posisi Sell saat kondisi Sell terpenuhi dan kita belum punya satu dibuka. Kini kita sudah mengembangkan strategi kita sekarang saatnya untuk mulai menulis kode kita.2 Menulis Expert Advisor. Begin dengan meluncurkan Editor Bahasa MetaQuotes 5 Kemudian tekan Ctrl N atau klik pada tombol New pada bilah Menu. Gambar 1 Memulai dokumen MQL5 baru. Di jendela Wizard MQL5, pilih Expert Advisor dan klik Next seperti yang ditunjukkan pada Gambar 2. Gambar 2 Memilih Tipe program. Di jendela berikutnya, ketik Nama yang ingin Anda berikan ke EA Anda di kotak Name Dalam kasus ini, saya mengetik MyFirstEA Anda kemudian bisa mengetikkan nama Anda di kotak Penulis dan juga alamat situs web Anda atau alamat email di Link Kotak jika Anda memilikinya. Gambar 3 Sifat umum dari Pakar Adv Karena kami ingin dapat mengubah beberapa parameter untuk EA kami untuk melihat nilai mana yang dapat memberi kami hasil terbaik, kami akan menambahkannya dengan mengklik tombol Add. Gambar 4 Mengatur parameter masukan EA. EA kami, kami ingin bisa bereksperimen dengan pengaturan Stop Loss, Take Profit, ADX Period, dan Moving Average Period, jadi kami akan menentukannya pada titik ini. Klik di bawah bagian Name dan ketik nama parameternya, Lalu klik dua kali di bawah Type to Select the data type untuk parameternya, dan klik dua kali pada bagian Initial value dan ketik nilai awal untuk parameter. Setelah selesai, seharusnya terlihat seperti ini. Gambar 5 Tipe data EA Parameter input. Seperti yang dapat Anda lihat di atas, saya memilih tipe data integer int untuk semua parameter Mari kita berbicara sedikit tentang tipe data. char Karakter char membutuhkan memori 1 byte 8 bit dan memungkinkan untuk mengekspresikan notasi biner 2 8 256 nilai Jenis char bisa mengandung baik positif maupun negatif Nilai Kisaran nilai adalah dari -128 sampai 127.uchar Tipe integer uchar juga menempati memori 1 byte, dan juga tipe char, tapi tidak seperti uchar yang ditujukan hanya untuk nilai positif Nilai minimumnya adalah nol, nilai maksimum Adalah 255 Huruf pertama u atas nama jenis uchar adalah singkatan untuk unsigned. short Ukuran tipe pendek adalah 2 byte 16 bit dan, karenanya, memungkinkan untuk mengekspresikan kisaran nilai sama dengan 2 pada daya 16 2 16 65 536 Karena tipe pendek adalah tanda satu, dan mengandung nilai positif dan negatif, kisaran nilai antara -32 768 dan 32 767.ushort Tipe pendek yang tidak bertanda adalah tipe ushort yang juga memiliki ukuran 2 byte Nilai minimum adalah 0, nilai maksimum adalah 65 535.int Ukuran tipe int adalah 4 byte 32 bit Nilai minimal adalah -2 147 483 648, yang maksimal adalah 2 147 483 647.uint Tipe integer unsigned adalah Uint Dibutuhkan memori 4 byte dan memungkinkan bilangan bulat dari 0 sampai 4 294 967 295.long Ukuran Tipe panjangnya adalah 8 byte 64 bit Nilai minimumnya adalah -9 223 372 036 854 775 808, nilai maksimumnya adalah 9 223 372 036 854 775 807.ulong Jenis ulong juga menempati 8 byte dan bisa menyimpan nilai dari 0 sampai 18 446 744 073 709 551 615. Dari uraian di atas dari berbagai tipe data, tipe integer unsigned tidak dirancang untuk menyimpan nilai negatif, setiap upaya untuk menetapkan nilai negatif dapat menyebabkan konsekuensi tak terduga Misalnya, jika Anda ingin menyimpan nilai negatif , Anda tidak dapat menyimpannya di dalam tipe unsigned yaitu uchar, uint, ushort, ulong. Back ke EA kami Melihat tipe data, Anda akan setuju dengan saya bahwa kita kira menggunakan tipe data char atau uchar karena data yang ingin kita gunakan Simpan dalam parameter ini kurang dari 127 atau 255 masing-masing Untuk manajemen memori yang baik, ini adalah hal terbaik yang harus dilakukan. Namun demi diskusi kita, kita tetap akan menyukai tipe int. Setelah selesai mengatur semua parameter yang diperlukan, Klik tombol Selesai dan MetaQuote S Editor akan membuat kerangka kode untuk Anda seperti yang ditunjukkan pada gambar berikutnya. Mari kita jeda kode ke berbagai bagian untuk pemahaman yang lebih baik. Bagian atas Header kode adalah tempat properti EA didefinisikan. Anda dapat melihat Di sinilah nilai-nilai yang Anda isi pada Wizard MQL5 pada gambar 3. Pada bagian kode ini, Anda dapat menentukan parameter tambahan seperti uraian singkat deskripsi singkat EA, menyatakan konstanta, termasuk file tambahan atau fungsi impor. Ketika sebuah pernyataan dimulai Dengan simbol, ini disebut perintah preprocessor dan tidak diakhiri dengan contoh koma semikolon lainnya dari perintah preprocessor. Perintah direktif digunakan untuk deklarasi konstanta ditulis dalam bentuk. Define identifier tokenstring. Apa yang dilakukan ini adalah mengganti setiap kejadian identifier dalam kode anda dengan nilai tokenstring. Define ABC 100 define COMPANYNAME MetaQuotes Software Corp. Ini akan menggantikan setiap kemunculan COMPANYNAME dengan string MetaQuotes Software Corp atau akan mengganti setiap kejadian ABC dengan char atau integer 100 di kode Anda. Anda dapat membaca lebih lanjut tentang perintah preprocessor di Manual MQL5 Mari kita lanjutkan diskusi kita. Bagian kedua dari header kode kita adalah parameter masukan. Tentukan semua parameter, yang akan digunakan di EA kita di bagian ini Ini mencakup semua variabel yang akan digunakan oleh semua Fungsi yang akan kita tulis di EA. Variables kita yang dideklarasikan pada level ini disebut Global Variables karena dapat diakses oleh setiap fungsi di EA kita yang mungkin membutuhkannya Parameter input adalah parameter yang hanya bisa diubah di luar EA kita. Kita juga bisa Menyatakan variabel lain yang akan kita manipulasi dalam perjalanan EA kita tapi tidak akan tersedia di luar EA kita di bagian ini. Selanjutnya adalah fungsi inisialisasi EA. Ini adalah cemara St yang disebut saat EA diluncurkan atau dilekatkan pada grafik dan hanya dipanggil sekali. Bagian ini adalah tempat terbaik untuk melakukan beberapa pemeriksaan penting agar EA kita dapat bekerja dengan baik. Kita dapat memutuskan untuk mengetahui apakah Bagan memiliki cukup banyak bar untuk EA kita untuk bekerja, dll. Ini juga merupakan tempat terbaik untuk mendapatkan pegangan yang akan kita gunakan untuk indikator ADX dan Moving Average indicator. Fungsi OnDeinit disebut saat EA dihapus dari grafik Untuk EA kami, kami akan melepaskan pegangan yang dibuat untuk Indikator kami selama inisialisasi di bagian ini. Fungsi ini memproses peristiwa NewTick yang dihasilkan saat kutipan baru diterima dengan simbol. Perhatikan, Expert Advisor tidak dapat melakukan operasi perdagangan jika Penggunaan Expert Advisor di terminal klien tidak diperbolehkan Button Auto Trading. Gambar 6 Autotrading diaktifkan. Sebagian besar kode kita yang akan menerapkan strategi trading kita, yang dikembangkan sebelumnya, akan ditulis dalam bagian ini. Sekarang kita telah melihat ke arah E berbagai bagian kode untuk EA kita, mari kita mulai menambahkan daging ke kerangka.2 2 BAGIAN PARAMETERS INPUT. Seperti yang dapat Anda lihat, kami telah menambahkan lebih banyak parameter Sebelum kami terus mendiskusikan parameter baru, mari kita bahas sesuatu yang dapat Anda lihat. Sekarang Dua garis miring ke depan memungkinkan kita untuk memberikan komentar dalam kode kita Dengan komentar, kita dapat mengetahui seperti apa variabel kita, atau apa yang kita lakukan pada saat itu dalam kode kita Ini juga memberi pemahaman yang lebih baik tentang kode kita Ada Adalah dua cara dasar untuk menulis komentar. Ini adalah komentar baris tunggal. Ini adalah komentar multi-baris. Ini adalah komentar multi-baris Komentar multi-line dimulai dengan sepasang simbol dan diakhiri dengan yang satu. Kompilator mengabaikan semua Komentar saat mengkompilasi kode Anda. Menggunakan komentar satu baris untuk parameter masukan adalah cara yang baik untuk membuat pengguna EA memahami apa parameter yang ada pada properti Masukan EA, pengguna kami tidak akan melihat parameter itu sendiri, namun mereka akan melihat Komentar seperti yang ditunjukkan Di bawah ini. Gambar 7 parameter masukan Expert Advisor. Sekarang, kembali ke kode kita. Kami telah memutuskan untuk menambahkan parameter tambahan untuk EA kami The EAMagic adalah nomor ajaib untuk semua pesanan oleh EA kami Nilai ADX minimum AdxMin dinyatakan sebagai tipe data ganda Sebuah double digunakan untuk menyimpan konstanta floating point, yang berisi sebuah bilangan bulat, titik desimal, dan pecahan part. double mysum 123 5678.double b7 0 09876. Lot to trade Lot mewakili volume instrumen keuangan yang kita inginkan. Perdagangan Kemudian kita menyatakan parameter lain yang akan kita gunakan. AdxHandle akan digunakan untuk menyimpan pegangan indikator ADX, sementara maHandle akan menyimpan pegangan untuk indikator Moving Average PlsDI, minDI, adxVal adalah array dinamis yang akan menampung Nilai DI, - DI dan ADX utama dari ADX Indicator untuk setiap batang pada tabel The maVal adalah array dinamis yang akan menyimpan nilai dari indikator Moving Average untuk setiap bilah pada grafik. Dengan cara, apa yang dinamis array Sebuah array dinamis adalah Sebuah array yang dideklarasikan tanpa dimensi Dengan kata lain, tidak ada nilai yang ditentukan dalam sepasang tanda kurung siku Sebuah array statis, di sisi lain memiliki dimensi yang didefinisikan pada titik deklarasi. double allbars 20 ini akan mengambil 20 elemen. Variabel yang akan kita gunakan untuk menyimpan harga Close untuk bar yang akan kita monitor untuk memeriksa perdagangan Buy Sell. STP dan TKP kita akan digunakan untuk menyimpan nilai Stop Loss dan Take Profit di EA.2 3 EA kita. SIFAT INTIALISASI. Di sini kita memperoleh pegangan indikator kita dengan menggunakan fungsi indikator masing-masing. Penanganan indikator ADX diperoleh dengan menggunakan fungsi iADX Dibutuhkan simbol grafik NULL juga berarti simbol saat ini pada grafik saat ini, periode waktu grafik 0 juga Berarti jangka waktu saat ini pada grafik saat ini, periode rata-rata ADX untuk menghitung indeks yang kami definisikan sebelumnya di bawah bagian parameter masukan sebagai parameter atau argumen. int IADX string symbol, nama simbol ENUMTIMEFRAMES p Eriod, periode rata-rata per periode adxperiod. Pemuat indikator Moving Average diperoleh dengan menggunakan fungsi iMA. Ini memiliki argumen berikut. Simbol grafik yang dapat diperoleh dengan simbol simbol atau NULL untuk simbol saat ini pada grafik saat ini. Pada periode grafik Jangka waktu yang dapat diperoleh dengan menggunakan periode periode atau 0 untuk jangka waktu saat ini pada grafik saat ini. Pada periode rata-rata Moving Average yang telah kita definisikan sebelumnya di bawah parameter masukan. Pergeseran indikator relatif terhadap perubahan grafik harga di sini adalah 0. the Moving Tipe rata-rata perataan rata-rata dapat berupa metode rata-rata berikut rata-rata berikut Averaging-MODESMA, Exponential Averaging-MODEEMA, rata-rata Merata-MODESMMA atau Linear-Weighted Averaging-MODELWMA, dan harga yang digunakan untuk rata-rata di sini kita menggunakan harga penutupan. Simbol simbol nama ENUMTIMEFRAMES periode periode int maperiod periode rata-rata int mashift pergeseran horizontal ENUMMAMETHOD mamethod smoothing jenis ENUMAPPLIEDPRICE appliedpri Ce jenis harga atau handle. Please baca manual MQL5 untuk mendapatkan rincian lebih lanjut tentang fungsi indikator Ini akan memberi Anda pemahaman yang lebih baik tentang bagaimana menggunakan masing-masing indikator. Kami sekali lagi mencoba untuk memeriksa kesalahan jika fungsi tidak berhasil kembali. Pegangannya, kita akan mendapatkan error INVALIDHANDLE Kita menggunakan fungsi waspada untuk menampilkan kesalahan dengan menggunakan fungsi GetlastError. Kita memutuskan untuk menyimpan nilai Stop Loss dan Take Profit pada variabel STP dan TKP yang kita nyatakan sebelumnya Mengapa kita melakukan ini? Itu karena nilai yang tersimpan dalam parameter INPUT hanya bisa dibaca, maka tidak dapat dimodifikasi. Jadi, di sini kita ingin memastikan bahwa EA kita bekerja sangat baik dengan semua broker Digit atau Digit mengemukakan jumlah digit desimal yang menentukan keakuratan harga. Dari simbol grafik saat ini Untuk grafik harga 5 digit atau 3 digit, kita mengalikan Stop Loss dan Take Profit dengan 10.2 4 SISA DEINTIALISASI EA. Karena fungsi ini disebut kapan EA dimatikan atau dihapus. Sebuah bagan, kami akan melepaskan semua pegangan indikator yang dibuat selama proses inisialisasi di sini Kami membuat dua pegangan, satu untuk indikator ADX dan pegangan lain untuk indikator Moving Average. Kami akan menggunakan fungsi IndicatorRelease untuk menyelesaikannya. Ini hanya memerlukan satu Argumen indikator handle. bool indikatorRelease int indicatorhandle indicator handle. Fungsi melepas handle indikator dan lepaskan blok perhitungan indikator, jika tidak digunakan.2 5 EA ONTICK SECTION. Hal pertama yang harus kita lakukan disini adalah Untuk memeriksa apakah kita memiliki cukup banyak batang pada grafik sekarang Kita bisa mendapatkan total bar dalam sejarah grafik apapun menggunakan fungsi Bars Dibutuhkan dua parameter, simbol dapat diperoleh dengan menggunakan Symbol or Symbol Kedua mengembalikan simbol saat ini untuk tabel saat ini Dimana EA kita dilampirkan dan jangka waktu atau jangka waktu dari grafik sekarang dapat diperoleh dengan menggunakan Periode atau Periode Kedua akan mengembalikan kerangka waktu dari grafik saat ini dimana t Dia EA dilampirkan. Jika total bar yang tersedia kurang dari 60, kami ingin EA kami bersantai sampai kami memiliki cukup bar yang tersedia di bagan Fungsi Alert menampilkan pesan di jendela terpisah Dibutuhkan nilai yang dipisahkan dengan koma sebagai argumen parameter. Dalam hal ini, kita hanya memiliki satu nilai string. Kembalinya keluar dari inisialisasi EA kita. Expert Advisor akan melakukan operasi perdagangan pada awal bar baru, jadi perlu untuk menyelesaikan masalah dengan identifikasi bar yang baru. , Kami ingin memastikan bahwa EA kami tidak memeriksa setup Long Short pada setiap tick, kami hanya ingin EA kami memeriksa posisi Long Short ketika ada bar baru. Kami memulai dengan mendeklarasikan variabel datetime statis OldTime yang akan menyimpan Waktu Bar Kami menyatakannya sebagai statis karena kami ingin nilai dipertahankan dalam memori sampai panggilan berikutnya dari fungsi OnTick Kemudian kami akan dapat membandingkan nilainya dengan variabel NewTime juga tipe data datetime, yang merupakan array o F satu elemen untuk menahan bar waktu bar baru Kami juga mendeklarasikan variabel tipe data bool IsNewBar dan menetapkan nilainya menjadi false Ini karena kami ingin nilainya BENAR hanya jika kita memiliki bar baru. Kami menggunakan fungsi CopyTime untuk mendapatkan Waktu bar saat ini Ini menyalin waktu bar ke array NewTime dengan satu elemen jika berhasil, kita membandingkan waktu bar baru dengan waktu bar sebelumnya Jika waktunya tidak sama, itu berarti kita memiliki yang baru. Bar, dan kita tetapkan variabel IsNewBar menjadi TRUE dan simpan nilai bar saat ini ke variable OldTime. IsNewBar variable menunjukkan bahwa kita memiliki bar baru Jika s FALSE, kita menyelesaikan eksekusi fungsi OnTick. Pada code. it memeriksa eksekusi mode debug, maka akan mencetak pesan tentang bar kali saat mode debug, kita akan mempertimbangkannya lebih lanjut. Hal berikutnya yang ingin kita lakukan disini adalah mengecek apakah kita memiliki cukup bar untuk bekerja dengan Mengapa mengulanginya Kami hanya ingin memastikan bahwa EA kami bekerja dengan benar Perlu dicatat bahwa sementara fungsi OnInit dipanggil hanya sekali saat EA dilekatkan pada tabel, fungsi OnTick dipanggil setiap kali ada kutipan harga tick baru. Anda amati bahwa kita telah melakukannya lagi secara berbeda di sini Kami memutuskan untuk menyimpan Total bar dalam sejarah yang kami dapatkan dari ekspresinya. Dalam variabel baru, Mybars menyatakan dalam fungsi OnTick Variabel ini adalah variabel lokal, tidak seperti variabel yang kami nyatakan di bagian INPUT PARAMETERS pada kode kami. Sementara variabel, dinyatakan di Bagian Parameter Masukan dari kode kita, tersedia untuk semua fungsi, dalam kode kita yang mungkin memerlukannya, variabel yang dinyatakan dalam satu fungsi terbatas dan tersedia untuk fungsi itu saja. Tidak dapat digunakan di luar fungsi itu. Selanjutnya, kita menyatakan Beberapa variabel tipe struktur MQL5 yang akan digunakan di bagian EA MQL5 ini memiliki cukup banyak struktur yang dibangun di dalam hal-hal yang membuat banyak hal menjadi mudah bagi pengembang EA. Mari mengambil Struktur satu per satu Er yang lain. Ini adalah struktur yang digunakan untuk menyimpan harga simbol terbaru. Mendesain MqlTick waktu datetime Waktu harga terakhir memperbarui tawaran ganda Harga penawaran saat ini danda meminta harga Tanya sekarang dua kali Harga terakhir dari kesepakatan terakhir Volume ulong terakhir Volume untuk Current Last price. Setiap variabel yang dinyatakan sebagai tipe MqlTick dapat dengan mudah digunakan untuk mendapatkan nilai Ask, Bid, Last dan Volume saat ini setelah Anda memanggil fungsi SymbolInfoTick. Jadi, kami menyatakan harga terbaru sebagai tipe MqlTick sehingga kami bisa menggunakan Itu untuk mendapatkan harga Ask and Bid. Struktur ini digunakan untuk melakukan semua permintaan perdagangan untuk operasi perdagangan. Strukturnya, dalam strukturnya, semua bidang yang diperlukan untuk melakukan kesepakatan perdagangan. hasil MqlTradeRequest ENUMTRADEREQUESTACTIONS tindakan Perdagangan jenis operasi ulong magic Expert Advisor ID nomor ajaib perintah ulong Order simbol tiket simbol Perdagangan simbol volume ganda Diminta volume untuk kesepakatan di banyak harga ganda Harga double stoplimit StopLimit tingkat Order double sl Tingkat Stop Loss order double tp Take Profit level order ulong deviation Maksimal kemungkinan penyimpangan dari harga yang diminta Tipe ENUMORDERTYPE Jenis pesanan ENUMORDERTYPEFILLING typefilling Jenis eksekusi order ENUMORDERTYPETIME typetime Waktu eksekusi order kadaluarsa kadaluwarsa Order waktu kadaluwarsa untuk pesanan ORDERTIMESPECIFIED Ketik komentar string Order comment. Setiap variabel yang dinyatakan sebagai tipe MqlTradeRequest dapat digunakan untuk mengirim pesanan untuk operasi perdagangan kami Di sini kami menyatakan bahwa kami adalah tipe MqlTradeRequest. Hasil dari setiap operasi perdagangan dikembalikan sebagai struktur standar khusus tipe MqlTradeResult Setiap variabel yang dinyatakan sebagai tipe MqlTradeResult akan dapat mengakses hasil permintaan perdagangan. Bangun MqlTradeResult uint kode ulang kode pengembalian operasi ulong deal Deal ticket, jika dilakukan ulong order Order ticket, jika ditempatkan volume volume volume ganda, dikonfirmasi oleh Harga ganda broker Harga kesepakatan, dikonfirmasi b Y broker tawaran ganda Harga penawaran saat ini ganda bertanya saat ini Meminta harga string komentar Broker komentar untuk operasi secara default itu diisi oleh deskripsi operasi. Harga Buka, Tutup, Tinggi, Rendah, Waktu, Volume masing-masing batang dan spread untuk Sebuah simbol disimpan dalam struktur ini Setiap array yang dinyatakan tipe MqlHarga dapat digunakan untuk menyimpan harga, volume dan sejarah penyebaran untuk simbol. struktur Mql Waktu datetime waktu Periode waktu mulai terbuka ganda Harga terbuka dua kali tinggi Harga tertinggi dari Periode double low Harga terendah dari periode double close Tutup price long tickvolume Tick volume int spread Spread realvolume panjang Volume perdagangan. Di sini kita telah menyatakan sebuah array mrate yang akan digunakan untuk menyimpan informasi ini. Selanjutnya kita memutuskan untuk mengatur semua array kita. Akan digunakan untuk menyimpan detail Bar sebagai rangkaian Ini untuk memastikan bahwa nilai yang akan disalin ke array akan diindeks seperti timeseries, yaitu, 0, 1, 2, 3, agar sesuai dengan batang ind Ex Jadi kita menggunakan ArraySetAsSeries function. bool ArraySetAsSeries void array array dengan referensi bool set true menunjukkan urutan pengindeksan yang terbalik. Perlu dicatat bahwa ini juga dapat dilakukan satu kali pada bagian inisialisasi kode kita Namun, saya telah memutuskan untuk menunjukkannya. Pada titik ini untuk kepentingan penjelasan kami. Kami sekarang menggunakan fungsi SymbolInfoTick untuk mendapatkan kutipan harga terbaru. Fungsi ini mengambil dua simbol grafik argumen dan variabel struktur MqlTick latestprice Sekali lagi, jika ada kesalahan, kami melaporkannya. Selanjutnya kami menyalinnya. Informasi tentang tiga bar terakhir ke dalam array tipe Mqlrates kami menggunakan fungsi Copy Rates Fungsi Copy Rates digunakan untuk mendapatkan data sejarah struktur Mql Rates pada Periode Simbol tertentu dalam jumlah tertentu ke dalam tipe Mql harga array. int Copy popularity string symbolname nama simbol ENUMTIMEFRAMES kerangka waktu period int startpos start position int count data count to copy MqlRates ratesarray target array to copy. The symbol name is obtained by usi ng symbol the current period timeframe is obtained by using period For the start position, we will start from the current bar, Bar 0 and we will count only three Bars, Bars 0, 1, and 2 The result will be store in our array, mrate. The mrate array now contains all the price, time, volumes and spread information for bars 0 1 and 2 Therefore to get the details of any bar, we will use the following. for example, we can have the following information about each bar. Bar 1 Start time Bar 1 Open price Bar 0 current bar high price, etc. Next we, copied all the indicator values into the dynamic arrays we have declared using the CopyBuffer function. int CopyBuffer int indicatorhandle , indicator handle int buffernum , indicator buffer number int startpos , start position int count , amount to copy double buffer target array to copy. The indicator handle is the handle we created in the OnInit section Concerning buffer numbers, the ADX indicator has three 3 buffers. The Moving Average indicator has only one 1 buffer. We copy from the present bar 0 to the past two bars So amount of records to copy is 3 bars 0, 1 and 2 The buffer is the target dynamic arrays we had earlier declared adxVal, plsDI, minDI and maVal. As you can see here again, we try to capture any error that may occur in the copying process If there is error, no need to go further. It is important to note that the CopyBuffer and the CopyRates function returns the total number of records copied on su ccess while it returns -1 incase of an error That is why we are checking for a value less than 0 zero in the error checking functions here. At this point we want to check if we already have a Buy or Sell position opened, in order words, we want to make sure we have only ONE Sell or Buy trade opened at a time We do not want to open a new Buy if we already have one, and we do not want to open a new Sell if we already have one opened. To achieve we will first of all declare two bool data type variables Buyopened and Sellopened which will hold a TRUE value if we already have a position opened for either Buy or Sell. We use the trade function PositionSelect to know if we have an open position This function returns TRUE if we have a position opened already and FALSE if we have none. It takes, as the major argument parameter, the symbol currency pair we want to check Here, we use symbol because we are checking the current symbol currency-pair. If this expression returns TRUE, then we want to check if the position opened is a Buy or a Sell We use the PositionGetInteger function for this it gives us the type of position opened when we use it with the POSITIONTYPE modifier It returns the Position type identifier which can either be POSITIONTYPEBUY or POSITIONTYPESELL. In our case, we used it to determine which of the position we already have opened If it is a Sell, we store a TRUE value in Sellopened and if it is a Buy, we store a TRUE value in Buyopened We will be able to use these two variables later when we are checking for Sell or Buy conditions later in our code. It is now time to store the close price for the bar we will be using for our Buy Sell setup Remember we declared a variable for that earlier. Having done this, we will now proceed to the next step. It is now time to start checking for a Buy opportunity. Let us analyze the expression above as it represents the strategy we designed earlier We are declaring a bool type variable for each of our conditions that must be met bef ore an order can be placed A bool type variable can only contain TRUE or FALSE So, our Buy strategy has been broken down into four conditions If any of the conditions is met or satisfied, then a value of TRUE is stored in our bool type variable, otherwise, a value of FALSE will be stored Let us look at them one by one. Here we are looking at the MA-8 values on Bars 0, 1 and 2 If value of MA-8 on the current bar is greater than its value on the previous Bar 1 and also the MA-8 value on Bar 1 is greater than its value on Bar 2 it means that MA-8 is increasing upwards This satisfies one of our conditions for a Buy setup. This expression is checking to see if Bar 1 Close price is higher than the value of MA-8 at the same period Bar 1 period If the price is higher, then our second condition has also been satisfied, then we can check for other conditions However, if the two conditions we have just considered were not met, then there will be no need to check other conditions That is why we deci de to include the next expressions within these two initial conditions expressions. Now we want to check if the current value of ADX ADX value on Bar 0 is greater than the Minimum ADX value declared in the input parameters If this expression is true, that is, the current value of ADX is greater than the Minimum required value we also want to be sure that the plusDI value is greater than the minusDI value This is what we achieved in the next expression. If all these conditions are met, that is, if they return true, then we want to be sure that we do not open a new Buy position if we already have one It is now time to check the value of the Buyopened variable we declared earlier in our code. If Buyopened is true, we do not want to open another Buy position, so, we display an alert to inform us and then return so that our EA will now wait for the next Tick However, if Buyopened is FALSE, then we prepare our records using the MqlTradeRequest type variable mrequest which we declared earlier to send our order. The action here, which is the trade operation type, is TRADEACTIONDEAL because we are placing a trade order for an immediate execution If we are modifying an order, then we will use TRADEACTIONMODIFY To delete an order we will use TRADEACTIONREMOVE We used our MqlTick type latestprice to get the latest Ask price The order Stop loss price is obtained by subtracting our StopLoss in points from the Ask price while the order take profit price is obtained by adding our TakeProfit in points to the Ask price You will also observe that we used the NormalizeDouble function for the Ask price, the StopLoss and TakeProfit values, it is good practice to always normalize these prices to the number of digits of currency pair before sending it to the trade server. The symbol is the current symbol Symbol or Symbol The order type is the type of order we are placing, here we are placing a buy order ORDERTYPEBUY For a Sell order, it will be ORDERTYPESELL. The order typefilling is the order e xecution type ORDERFILLINGFOK means that the deal can be executed exclusively with a specified volume at the equal or better price than the order specified price If there is no sufficient volume of offers on the order symbol, the order will not be executed. The OrderSend function takes two arguments, the MqlTradeRequest type variable and the MqlTradeResult type variable. As you can see, we used our MqlTradeRequest type variable and the MqlTradeResult type variable in placing our order using OrderSend. Having sent our order, we will now use the MqlTradeResult type variable to check the result of our order If our order is executed successfully, we want to be informed, and if not, we want to know too With the MqlTradeResult type variable mresult we can access the Operation return code and also the order ticket number if the order is placed. The return code 10009 shows that the OrderSend request was completed successfully, while 10008 shows that our order has been placed That is why we have ch ecked for any of these two return codes If we have any of them, we are sure that our order has been completed or it has been placed. To check for a Sell Opportunity, we check for the opposite of what we did for Buy Opportunity except for our ADX that must be greater than the Minimum value specified. Just as we did in the buy section, we are declaring a bool type variable for each of our conditions that must be met before an order can be placed A bool type variable can only contain TRUE or FALSE So, our Sell strategy has been broken down into four conditions If any of the conditions is met or satisfied, then a value of TRUE is stored in our bool type variable, otherwise, a value of FALSE will be stored Let us look at them one by one as we did for the Buy section. Here we are looking at the MA-8 values on Bars 0, 1 and 2 If value of MA-8 on the current bar is less than its value on the previous Bar 1 and also the MA-8 value on Bar 1 is less than its value on Bar 2 it means that MA-8 is decr easing downwards This satisfies one of our conditions for a Sell setup. This expression is checking to see if Bar 1 Close price is lower than the value of MA-8 at the same period Bar 1 period If the price is lower, then our second condition has also been satisfied, then we can check for other conditions However, if the two conditions we have just considered were not met, then there will be no need to check other conditions That is why we decide to include the next expressions within these two initial conditions expressions. Now we want to check if the current value of ADX ADX value on Bar 0 is greater than the Minimum ADX value declared in the input parameters If this expression is true, that is, the current value of ADX is greater than the Minimum required value we also want to be sure that the MinusDI value is greater than the plusDI value This is what we achieved in the next expression. If these conditions are met, that is, if they return true, then we want to be sure that we do not op en a new Buy position if we already have one It is now time to check the value of the Buyopened variable we declared earlier in our code. If Sellopened is true, we do not want to open another Sell position, so, we display an alert to inform us and then return so that our EA will now wait for the next Tick However, if Sellopened is FALSE, then we setup our Sell trade request as we did for Buying order. The major difference here is the way we calculated our stop loss price and take profit price Also since we are selling, we sell at the Bid price that is why we used our MqlTick type variable latestprice to get the latest bid price The other type here, as explained earlier, is ORDERTYPESELL. Also here, we used the NormalizeDouble function for the Bid price, the StopLoss and TakeProfit values, it is good practice to always normalize these prices to the number of digits of currency pair before sending it to the trade server. Just as we did for our Buy order, we must also check if our Sell order is successful or not So we used the same expression as in our Buy order.3 Debugging and Testing our Expert Advisor. At this point, we need to test our EA to know it our strategy works or not Also, it is possible that there are one or two errors in our EA code This will be discovered in the next step. Debugging our code helps us to see how our code performs line by line if we set breakpoints and there and then we can notice any error or bug in our code and quickly make the necessary corrections before using our code in real trade. Here, we are going to go through the step by step process of debugging our Expert Advisor, first of all, by setting breakpoints and secondly, without breakpoints To do this, Make sure you have not closed the Editor First of all, let us select the chart we want to use to test our EA On the Editor Menu bar, click on Tools and click on Options as shown below. Figure 8 Setting Debugging options. Once the Options window appears, select the currency pair, and the period timeframe to use and click the OK button. Before we start the debugger, let us set breakpoints Breakpoints allow us to monitor the behavior performance of our code at certain selected locations or lines Rather than running through all the code at once, the debugger will stop whenever it see a breakpoint, waiting for your net action By this we will be able to analyze our code and monitor its behavior as it reaches every set break-points We will also be able to evaluate the values of some of our variables to see if things are actually the way we envisaged. To insert a breakpoint, go to the line in your code where you want to set the breakpoint By the left hand side, on the gray field near the border of the code line, double-click and you will see a small round blue button with a white square inside it Or on the alternative, place the cursor of your mouse anywhere on the code line where you want the breakpoint to appear and press F9 To remove the breakpoint, press F9 again or double-click o n it. Figure 10 Setting a breakpoint. For our code, we are going to set breakpoint on five different lines. I will also label them form 1 to 5 for the sake of explanation. To continue, set breakpoint at the seven code lines as shown in the figure below Breakpoint 1 is the one we have created above. Figure 11 Setting additional breakpoints. Once we have finished setting our breakpoints, we are now set to start debugging our code. To start the debugger, press F5 or click the green button on the Toolbar of the MetaEditor. Figure 12 Starting the Debugger. The first thing the editor does is to compile the code, if there is any error at the point, it will display it and if no error, it will let you know that the code compiled successfully. Figure 13 Compilation Report. Please note that the fact that the code compiled successfully does not mean there may not be errors in your code Depending on how your code is written, there may be runtime errors For example, if any of our expressions does not evaluate correctly due to any little oversight, the code will compile correctly but may not run correctly Too much of the talk, let s see it in action. Once the debugger has finished compiling the code, it takes you to the trading terminal, and attach the EA to the chart you have specified on the MetaEditor Options settings At the same time, it shows you the Input parameters section of the EA Since we are not adjusting anything yet, just click the OK button. Figure 14 Expert Advisor Input Parameters for Debugging. You will now see the EA clearly on the top-right hand corner of the chart. Once it starts the OnTick it will stop as soon as it gets to our breakpoint 1.Figure 15 Debugger stops at the first breakpoint. You will notice a green arrow at that code line That tells you that previous code line had been executed we are now ready to execute the present line. Let me make some explanations before we proceed If you look at the Editor s Tool Bar, you will observe that the three buttons with curved arr ows which were earlier grayed out are now activated This is because we are now running the debugger These buttons commands are used to step through our code Step into, Step over or Step out. Figure 16 Step into command. The Step Into is used to go from one step of the program execution into the next step, entering into any called functions within that code line Click on the button or press F11 to invoke the command We will use this command in our Step-by-Step debugging of our code. Figure 17 Step over command. The Step over on the other hand does not enter into any called function within that code line Click on the button or press F10 to invoke the command. Figure 18 Step out command. To execute a program step that is one level higher, you click this button or press Shift F11.Also, at the lower part of the Editor, you will see the Toolbox window The Debug tab in this window has the following headings. File This displays the name of the file been called. Function This displays the present funct ion from the file been called. Line This displays the number of the code line in the file from which the function is called. Expression This is where you can type the name of any expression variable you are interested in monitoring from our code. Value This will display the value of the expression variable we typed at the Expression area. Type This will display the data type of the expression variable been monitored. Back to our debugging process. The next thing we want to do is now to type in the variables expressions from our code that we are interested in monitoring Make sure you only monitor the variables expressions that really matters in your code For our example, we will monitor the following. OldTime old bar time. NewTime 0 current bar time. IsNewBar flag that indicates the new bar. Mybars Total bars in History Our EA depends on it. You can add other ones like the ADX values, the MA-8 values, etc. To add the expression variable, double-click under the Expressions area or right-click under the Expressions area and select Add as shown in the figure above. Type the expression variable to monitor or watch. Figure 19 The expressions watching window. Type all the necessary variables expressions. Figure 20 Adding expressions or variables to watch. If the variable hasn t been declared yet, its type is Unknown identifier except the static variables. Now, lets move on. Figure 21 Step into command in action. Click the Step into button or press F11 and observe what happens Keep on pressing this button or F11 until you get to breakpoint no 2 continue until you get to breakpoint no 4 as shown below and observe the expressions watching window. Figure 22 Watching the expressions or variables. Figure 23 Watching the expressions or variables. Figure 24 Watching the expressions or variables. Once there is a new tick, it will return to the fist code line of the OnTick function And all the values of our variables expression will now be reset because this is a new tick except if any of them is declared as a static variable In our case we have one static variable OldTime. Figure 25 Values of variables on NewTick event. To go over the process again, continue pressing the F11 key and keep monitoring the variables at the expressions watching window You can stop the debugger and then remove all the breakpoints. As we see, in Debug mode it prints the message We have new bar here. Figure 26 Expert Advisor prints the message in Debug mode. Start the debugging process again but this time without breakpoints Keep watching at every tick and if any of our Buy Sell condition is met, it will place a trade and since we have written our code to tell us if an order is placed successful or otherwise, we will see an alert. Figure 27 Expert Advisor places trade during debugging. I think you can leave the EA to work for a few more minutes while you take a coffee Once you are back and you have made some money just kidding , then click the STOP Red button on the MetaEditor to stop debugging. Figure 28 Stopping the debugger. What we have actually done here is to see that our EA only checks for a trade at the opening of a new Bar and that our EA actually works There is still a lot of room for adjustments to our EA code. Let me make it clear, at this point that, the Trading terminal must be connected to the internet, otherwise, debugging will not work because the terminal will not be able to trade.3 2 TESTING OUR EA STRATEGY. At this point we now want to test our EA using the Strategy Tester built into the Trading Terminal To start the Strategy Tester, press CONTROL R or click the View menu on the Terminal Menu Bar and click on Strategy Tester as shown below. Figure 26 Starting the Strategy Testing. The Tester Strategy Tester is shown at the lower part of the terminal For you to see all the Tester s settings, you need to expand resize it To do this, move your mouse pointer to the point shown by the red arrow as shown below. Figure 27 The Strategy Tester window. The mouse pointer changes to a double-end a rrow, hold down the mouse and drag the line upwards Stop when you discover that you can see everything on the settings tab. Figure 28 The Strategy Tester Settings Tab. Select the EA you want to test. Select the Currency pair to use for the test. Select the Period Timeframe to use for the test. Select Custom Period and set the dates in 5.Set the dates for the custom period to be used for the test. Execution is Normal. Select the deposit amount in USD to be used for the test. Set Optimization to Disable We are not optimizing now, we just want to test. Click this button when you are ready to start test. Before we click the Start button, lets look at the other tabs on the Tester. The processor used by the Tester for the Test Depending on your Computer s processor type Mine is only one 1 core processor. Figure 29 The Strategy Tester Agents tab. Once the agent, you will see something similar to the figure below. Figure 30 The Strategy Tester Agents tab during a test. This is where all the events going on d uring the test period is displayed. Figure 31 The Strategy Tester Journal tab showing trade activities. This is where you can specify the input parameters for the EA. Figure 32 The Strategy Tester Inputs tab. If we are optimizing our EA, then we will need to set the values in the circled area. The Start is the values you want the Tester to begin with. The Step is the increment rate for the value you selected, and. The Stop is the value at which the Tester will stop incrementing the value for that parameter. However, in our case we are not optimizing our EA, so we will not need to touch that for now. Once everything is set, we now go back to the Settings tab and click the Start button Then the tester begins its work All you need to do now is to go and take another cup of coffee if you like, or, if you are like me, you may want to monitor every event, then turn to the Journal tab. Once you begin to see messages about orders been sent on the Journal Tab, you may then wish to turn to a NEW tab named Graph which has just been created Once you switch to the Graph tab, you will see the graph keep on increasing or decreasing as the case may be depending on the outcome of your trades. Figure 33 The graph result for the Expert Advisor Test. Once the test is completed, you will see another tab called Results Switch to the Results tab and you will see the summary of the test we have just carried out. Figure 34 The Strategy Tester Results tab showing test results summary. You can see the total Gross Profit, Net Profit, total trades total loss trades and many more Its really interesting to see that we have about USD 1,450 0 within the period we selected for our test At least we have some profit. Let me make something very clear to you here You will discover that the settings for the EA parameters that you see in the Strategy tester is different from the initial settings in the Input parameters of the EA I have just demonstrated to you that you can change any of those input parameters to get the best out of your EA Instead of using a period of 8 each for the Moving Average and ADX, I changed it to 10 for Moving Average and 14 for ADX I also change the Stop Loss from 30 to 35 Last but not the least, I decided to use 2 Hour timeframe Remember, this is the Strategy Tester. If you want to view a complete report of the test, then right-click on anywhere in the Results tab, you will see a menu From this menu, Select Save as Report. Figure 35 Saving the result of the test. The save dialog window will appear, type a name for your report if you want, otherwise leave the default name and click the save button The whole report will be saved in HTML format for you. To view the chart for the test that was carried out, click Open Chart and you will see the chart displayed. Figure 36 The chart showing the test. That s it, we have successfully written and tested our EA and we now have a result to work with You can now go back to the strategy tester Settings tab and make the test for other Timefram es Period. I want you to carry out the test using different currency pairs, different timeframes, different Stop Loss, different Take profit and see how the EA performs You can even try new Moving Average and ADX values As I said earlier, that is the essence of the Strategy tester I will also like you to share your results with me. In this step by step guide, we have been able to look at the basic steps required in writing a simple Expert Advisor based on a developed trading strategy We have also looked at how we check our EA for errors using the debugger We also discussed how to test the performance of our EA using the Strategy Tester With this, we have been able to see the power and robustness of the new MQL5 language Our EA is not yet perfect or complete as many more adjustments must still be made in order to used it for real trading. There is still more to learn and I want you to read the article over again together with the MQL5 manual, and try everything you have learn in this artic le, I can assure you that you will be a great EA developer in no distant future. Hello Mr Olowoyo Thanks you very much for your extremelly interesting article about the way to build and EA It is simples for beginners and really helpful I am really new in the coding of EA but I realize it is extremelly necessary to test different strategies I have downloaded you EA and try to compile it but I get immediately 50 errors In the previous comments I did not see such problems reported by the users Please find enclosed a extract of the error table I will appreciate very to receive some help Jean Philippe. Hi Samuel your guide was awesome and really cleared the air but I have some problems in calling other indicators in my EA can you tell me how add MACD and VIDyA signals in my EA I need to calculate the Signal and Main amount of MACD for example but don t know how to call them in my EA That would be a great help if you tell me how to do that you are awesome. I am trying to compile the code provid ed in this tutorial but getting the error iADX wrong parameter count at the following line adxHandle iADX NULL,0,ADXPeriod The code seems fine to me How do I fix the error Could anyone help. Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising If you continue browsing the site, you agree to the use of cookies on this website See our User Agreement and Privacy Policy. Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising If you continue browsing the site, you agree to the use of cookies on this website See our Privacy Policy and User Agreement for details. Explore all your favorite topics in the SlideShare app Get the SlideShare app to Save for Later even offline. Continue to the mobile site. Double tap to zoom out. Forex trading for dummies 2016 updated. Share this SlideShare. LinkedIn Corporation 2017.Forex Day Trading - Why Us. Learn to trade Forex like a pro with our free train ing program You will learn how to trade with our powerful, proprietary trading systems and benefit from our unique mental training MP3 s. You ll also have the opportunity to trade for our retail and institutional clients as a money manager, prop trader, or hedge fund manager. It s the accelerated approach to a successful trading career. Forex Day Trading offers some unique services to our Investors and traders Here are some. Accelerated Trading Career Opportunity with FastTrack Enjoy professional trading tools and training via our FastTrack FX Pro Trader program For both beginner and advanced traders who want to trade for a living or more effectively. Attractive IB Program An introducing broker makes money by offering forex services to potential traders Qualified individuals and institutions welcomed. Maximum Safety of Funds via Trust For the first time ever, ANY size client can open a trust account This provides the ultimate environment for safety of funds, something that almost no brokerag e firm offers. Professionally Managed Accounts Created for investors who don t have time to trade their own account or want to add diversification to their investment portfolios. Free MP3 to Tune Your Mind for Trading Success Request a Free Demo from our main menu and download our proprietary Forex Mental Tuner MP3 which conditions your mind for trading success while you sleep. Advantages of Trading Forex. Trading the foreign exchange Forex or FX market has a number of advantages over stock and futures trading. Trading 24 Hours a Day From Sunday afternoon to Friday afternoon US time. Low Minimum Investment Trading currencies requires a lot less starting capital than trading stocks You can start with just 100 USD. Attractive IB Opportunities Offer forex services to traders and get compensated We offer one of the most beneficial IB programs in our Industry.1000 1 Leverage FX trading offers greater buying power than day trading stocks, which offers 4 1 maximum leverage. Tight Trading Spreads Frac tion of 1 pip Sub 1-pip spreads on some of the major currency pairs the majors. Simpler to Trade than Stocks There are only a few major currencies in forex, whereas in the equities market there are tens of thousands of possible stocks to trade. Free Trading Platform with Real-time Charts and News Free trading platform based on MetaTrader technology with streaming, real-time charts, news and commentary relevant to the currency market. No Re-Quotes on MT4 Platform During normal market volatility in the foreign exchange market. No Trading Restrictions in Falling Markets There are no restrictions to sell currencies short, unlike stocks, which have artificial restrictions in place when sold short or when the market drops by a given amount. Forex Market Latest News. The Euro was unable to sustain a recovery attempt on Tuesday and came under fresh selling pressure as the dollar gained renewed support after stronger than expected data The Australian Reserve Bank interest rate decision was one of the least Continue reading. Monday s trading maintained the familiar pattern seen after a Friday payroll release with generally lacklustre conditions and narrow ranges, amplified by the normal dip in trading volumes during August The dollar overall was still hampered by profit taking and corrective Continue reading. Friday s economic data was not strong enough to trigger further dollar buying with the currency subjected to profit taking after a strong week Equity markets generally remained on the defensive following sharp Wall Street losses overnight and risk conditions overall Continue reading. Start Your FX Business.
No comments:
Post a Comment