← К каталогу
Исходный код · ID 3333

AnyCandle

any candle [поручик].mq5
Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

AnyCandle — пользовательский индикатор для MetaTrader, который отображает на текущем графике свечу выбранного старшего таймфрейма, размещая её справа от цен. Например, на графике M15 можно вывести свечу H1, H4 или D1. Для каждой дополнительной свечи требуется отдельный экземпляр индикатора, а положение по горизонтали регулируется смещением отображения.

Индикатор рассчитывает значения Open, High, Low и Close выбранной свечи и рисует её в виде гистограммных буферов, окрашивая бычьи и медвежьи свечи разными цветами. Предыдущая свеча очищается при появлении нового бара на графике.

При включённом режиме оповещения индикатор отслеживает оставшееся до закрытия свечи время и при приближении момента закрытия меняет цвета и воспроизводит звуковой файл, соответствующий выбранному таймфрейму. Уровень срабатывания оповещения задаётся в процентах от длительности свечи.

Индикатор работает в окне графика, использует четыре буфера и не выполняет торговых операций.

Настройки программы

НастройкаОписание
Indicator_On Включить индикатор — Включает или отключает работу индикатора. При отключении индикатор удаляет свои объекты и не выполняет расчёты.
Comment0 Комментарий 0 — Текстовый разделитель, поясняющий группу настроек таймфрейма и смещения.
TimeFrame Таймфрейм — Таймфрейм отображаемой свечи. Задаётся в минутах, например 1, 5, 15, 30, 60, 240, 1440. При некорректном значении используется дневной таймфрейм.
Comment3 Комментарий 3 — Текстовый комментарий, поясняющий назначение смещения по времени.
TimeShift Смещение по времени — Смещение начального бара отображаемой свечи относительно текущего. Допустимый диапазон от 0 до 24; при некорректном значении используется 0.
Comment4 Комментарий 4 — Текстовый разделитель, поясняющий группу настроек отображения.
Comment5 Комментарий 5 — Текстовый комментарий, поясняющий использование нескольких экземпляров индикатора на одном графике.
Comment6 Комментарий 6 — Текстовый комментарий, поясняющий шаг смещения при нескольких экземплярах индикатора.
Comment7 Комментарий 7 — Текстовый комментарий, поясняющий шаг смещения при нескольких экземплярах индикатора.
Comment8 Комментарий 8 — Текстовый комментарий с примером значений смещения для нескольких экземпляров.
DisplayOffset Смещение отображения — Смещение отображения свечи по горизонтали. Используется для размещения нескольких экземпляров индикатора рядом без наложения.
Comment9 Комментарий 9 — Текстовый разделитель, поясняющий группу настроек оповещения.
Comment10 Комментарий 10 — Текстовый комментарий, поясняющий условие срабатывания оповещения.
Comment11 Комментарий 11 — Текстовый комментарий, поясняющий условие срабатывания оповещения.
Comment13 Комментарий 13 — Текстовый комментарий, поясняющий смысл уровня оповещения в процентах.
Comment14 Комментарий 14 — Текстовый комментарий, поясняющий смысл уровня оповещения в процентах.
Alarm_On Включить оповещение — Включает или отключает режим оповещения о приближающемся закрытии свечи. При включении индикатор меняет цвета и воспроизводит звук.
AlarmStartLevel Уровень начала оповещения — Пороговый уровень в процентах от длительности свечи, при котором срабатывает оповещение о скором закрытии. Допустимый диапазон от 0 до 100; при некорректном значении используется 10.
Получить полный код

Поиск по коду файла

/*******************************************************************************
 *                                                                AnyCandle.mq4 
 *                                                                         v1.1  
 *                                                             ? 2011 sunbrella 
 *
 * 
 * Overview 
 * ========
 * This is a simple indicator that displays one (or more) candle(s) of higher 
 * timeframes on the right side of your current chart E.g. If your chart is set 
 * to M15, you can add e.g. H1, H4 and D1 candles to your M15 chart side by side 
 * according to your AnyCandle settings. Note that each candle needs a separate 
 * AnyCandle instance.
 *
 * If you enable the Alarm feature, candle will start to change its colour  
 * when the candle is going to close within a few minutes (or seconds for lower 
 * timeframes) (you can set this level) plus gives you an easy to understand 
 * human voice speech alert as well. This will help to identify what candle
 * is going to be closed exactly. This way you will be notyfied in advance to be 
 * there when the candle closes. This is useful if you take into account closed 
 * candles' price spread and the accompanying volume in your decisions. This is 
 * where Anycandle can help especially when used together with SonicR volume 
 * indicators from TAH (see links below).
 * 
 * Note that volume always means activity of the BBs, worth considering. On the 
 * other hand, the volume you see in the spot forex market is limited to the 
 * volume of order-flow generated by the accounts (and account sizes) your 
 * broker has (worst case: you have an account at a "dealing desk MM broker", 
 * non dealing desk STP/ECN brokers are much reliable). 
 * 
 * So it is not the whole market at all and can be manipulated as well but still 
 * can be informative to some extent (for more reliable volume one has to trade 
 * futures).

 * Recommended links
 * =================
 * For an in depth discussion of the candle price spread and volume interrela-
 * tionship check the VSA thread along with a comprehensive guide in PDF 
 * (Master the Market)here: 
 * 
 *     Link: 
 *
 * For an easy to follow trading system check the SonicR thread here:
 *
 *     Link: 
 *
 * And finally a big thank you from here to the founder Sonic, TraderAtHome 
 * for his endless energy and efforts continuously enhancing the SonicR system 
 * with his high quality indicators and his clean templates, and you all being 
 * there for couple of years and sharing your valuable time and your set-ups.
 *
 * How to install
 * ===============
 * 1. Extract the attached ZIP file to your temporary folder.
 * 2. Copy the mq4 and ex4 files to the following folder:
 *
 *    c:\Program Files\YourBroker MetaTrader\experts\indicators\
 *
 * 3. Copy the WAV files to the following folder:
 *
 *    c:\Program Files\YourBroker MetaTrader\sounds\
 *
 *
 * How to use                      
 * ==========
 * First, check the AnyCandle_Settings.gif pic in the ZIP file as a quick 
 * reference guide, it has all the necessary info on how to set-up this 
 * indicator and shows a general view how it looks like on the chart. 
 * 
 * Setting-up: 
 * 1. add an AnyCandle instance to your chart
 * 2. set the TimeFrame property; AnyCandle will display the candle for that TF
 *    (1440 means daily candle, this is the default setting)
 * 3. set the TimeShift property if you want to see a different OHLC candle 
 *    from those on your chart (shifts the starting bar of the candle)
 * 4. set the DisplayOffset property (only if you use more than one AnyCandle 
 *    indicator on the same chart, otherwise you can leave it as is)
 * 5. set the Alarm settings (ON by default, 10% of candletime left until 
 *    candle closes)
 * 
 * Note: if you want to display more than one AnyCandle, you have to add a new
 * AnyCandle indicator for each new candle to your chart and set it for that 
 * new TF. Don't forget to change the DisplayOffset porperty (e.g. 10 for the 
 * second candle, 13 for the third), otherwise your new candle will be 
 * displayed over the previous candle.
 * 
 *
 * Legal notes 
 * ============
 * This code is free for any personal use (except commercial use). Feel free 
 * to enhance/modify the mq4 code and distribute it until you:
 * - do it free of charge
 * - leave the reference unchanged to the author of the original version
 * - leave the reference unchanged to this legal note
 * - your modifications are added to the version history
 * 
 * If you find any bug, feel free to contact me or repair it yourself ;-) 
 * Any optimization is welcome, pls send me a copy of the modified version.
 *
 * Hope you find it useful. 
 * 
 * Sunbrella, 05-17-2011 
 *
 *
 * Version history:
 * ----------------
 * 1.1: TimeShift and voice alerts added
 * 1.0: initial release
 *
 ********************************************************************************/

#property indicator_chart_window
#property indicator_buffers 4

extern bool   Indicator_On    = TRUE;
extern string Comment0        = "--- Timeframe and Shift Settings ---";
extern string Comment1        = "1 = M1; 5 = M5; 15 = M15; 30 = M30";
extern string Comment2        = "60 = H1; 240 = H4; 1440 = D1";
extern int    TimeFrame       = 60;
extern string Comment3        = "bars added to your broker time";
extern int    TimeShift       = 0;
extern string Comment4        = "--- Display Settings ---------------";
extern string Comment5        = "when multiple AnyCandle indicators";
extern string Comment6        = "are used on the same chart, add +3";
extern string Comment7        = "to the offset for each new AnyCandle";
extern string Comment8        = "instances (10, 13, etc.)";
extern int    DisplayOffset   = 7;
extern string Comment9        = "--- Alarm Settings -----------------";
extern string Comment10       = "if you want to see that the candle";
extern string Comment11       = "is going to close within a given";
extern string Comment12       = "period of time, set this to TRUE;";
extern string Comment13       = "10 means that colour will change";
extern string Comment14       = "when 10% of time left until close";
extern bool   Alarm_On        = TRUE;
extern int    AlarmStartLevel = 10;

double gdaLow[];     // 0 = Low
double gdaHigh[];    // 1 = High
double gdaClose[];   // 2 = Close
double gdaOpen[];    // 3 = Open

string gsCandleLabel;
string gsSoundFileName;
bool   gbFirstAlert = true;

int init() 
{
      // код доступен только после оплаты
   }
   if (Indicator_On)
   {

      TimeFrame     = ValidateTimeFrame(TimeFrame, "Candle");
      if ((Alarm_On) && ((AlarmStartLevel <

Показано первые 50% кода (символов: 9504)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
950,40₽ ≈ $11.62