//***********************************************************************// //***********************************************************************// //* Parabolic (Open_Close).mq4 *// //* Copyright © 2009, BACKSPACE *// //* Updating from 10.02.2010 *// //***********************************************************************// //***********************************************************************// //* Торгуй тренды *// //* Уменьшай потери *// //* Давай прибыли расти *// //* Управляй рисками *// //***********************************************************************// //***********************************************************************// #property copyright "Copyright © 2009, BACKSPACE" // #property link "Updating from 10.02.2010 " // // #property indicator_chart_window // #property indicator_buffers 1 // #property indicator_color1 Red // //******************// Ввод параметров индикатора extern double Max=0.009; // - максимальное значение Parabolic extern double Step=0.005; // - шаг изменения Parabolic //******************// Составные части индикатора double ParabolicSAR[], // - Parabolic SAR ParAle[], // - Алерт Parabolic HHigh, // - максимум тела бара LLow, // - минимум тела бара HHighPP, // - Previous Point HHigh LLowPP; // - Previous Point LLow //******************// Глобальные переменные int Counter; // - счётчик баров double IndexHL=1, // - индекс однонаправленного движения ExtremumLong, // - экстремум High ExtremumShort; // - экстремум Low string Typ="Short"; // - тип сделки //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //***********************************************************************// //**********************-Indicator Initialization-***********************// //***********************************************************************// // int init() // { //******************// Настройки графического отображения IndicatorBuffers(2); // SetIndexLabel(0,"ParabolicSAR"); // SetIndexStyle(0,DRAW_ARROW); // SetIndexArrow(0,159); // SetIndexBuffer(0,ParabolicSAR); // SetIndexBuffer(1,ParAle); // //*********// return(0); // } // //***********************************************************************// //*************************-Moving Rounding Off-*************************// //***********************************************************************// // int start() // { // int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; if(counted_bars==0) limit-=2; for(int mr=limit; mr>=1; mr--) // { // Bars_High_Low_Init(mr); //******************// Инициализация High/Low Parabolic_SAR(mr); //******************// Расчёт Parabolic SAR Extremum_Long_Short(mr); //******************// Экстремумы Long/Short } // //*********// return(0); // } // //***********************************************************************// //******************************-SubPogramms-****************************// //***********************************************************************// // //***********************************// Инициализация High/Low double Bars_High_Low_Init(int bhli) // { // if(iOpen(NULL,0,bhli)>iClose(NULL,0,bhli)) // { // HHigh =iOpen(NULL,0,bhli); // LLow =iClose(NULL,0,bhli); // } // else if(iOpen(NULL,0,bhli)ExtremumLong) // - индекс однонаправленного движения IndexHL++; // HHighPP=HHigh; // ParAle[ps]=ParAle[ps+1]; // return(0); // } // } // if(Typ=="Short") // { // if(HHigh>=ParabolicSAR[ps+1]) //******************// - условия разворота Long { // Typ="Long"; // ParabolicSAR[ps]=ExtremumShort; // ExtremumLong=HHigh; // IndexHL=1; // ParAle[ps]=1; // return(0); // } // else //******************// - открытая позиция Short { // ParabolicSAR[ps]=ParabolicSAR[ps+1]- // (Max+IndexHL*Step)*(ParabolicSAR[ps+1]-LLowPP); // if(LLowExtremumLong) //******************// - экстремум Long ExtremumLong=HHigh; // if(LLow