Camilo Mora:
Does anyone has a MQL5 version of the Chande Kroll Stop indicator willing to share?
I found the MQL4 version of it, but before start translating, wanted to ask if maybe someone already has it and is willing to share/post it?
I can give you a basic version.
//+------------------------------------------------------------------+ //| ChandeKrollStop.mq5 | //| Copyright 2024, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "2024, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property indicator_separate_window #property indicator_buffers 2 #property indicator_plots 1 //--- plot #property indicator_label1 "ChandeKrollStop" #property indicator_type1 DRAW_LINE #property indicator_color1 clrBlue //--- indicator buffers double ChandeKrollBuffer[]; double TriggerBuffer[]; //--- input parameters input int Period=10; input double ATRMultiplier=2.0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // Set indicator buffers SetIndexBuffer(0, ChandeKrollBuffer); SetIndexBuffer(1, TriggerBuffer); // Set buffer arrays to be drawn as a line PlotIndexSetInteger(0, PLOT_DRAW_TYPE, DRAW_LINE); PlotIndexSetInteger(1, PLOT_DRAW_TYPE, DRAW_LINE); // Set indicator label PlotIndexSetString(0, PLOT_LABEL, "ChandeKrollStop"); // Set indicator colors PlotIndexSetInteger(0, PLOT_LINE_COLOR, clrBlue); PlotIndexSetInteger(1, PLOT_LINE_COLOR, clrRed); //--- return value of initialization return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- check for data sufficiency if(rates_total<Period) return(0); int limit = MathMax(prev_calculated - 1, 0); for(int i = limit; i < rates_total && !IsStopped(); i++) { double ATR = iATR(Symbol(), Period(), i); ChandeKrollBuffer[i] = high[i] + ATRMultiplier * ATR; TriggerBuffer[i] = low[i] - ATRMultiplier * ATR; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Does anyone has a MQL5 version of the Chande Kroll Stop indicator willing to share?
I found the MQL4 version of it, but before start translating, wanted to ask if maybe someone already has it and is willing to share/post it?