Big massive thank you my friend
Thank you so much for this great indicator, I hope that other people get good use of it also
an mt5 version would be fantastic if you can do it
nice work
Momentum candles MT5
I have not done much in the way of MT5 code but I have managed to get this to work ( see screenshot below ), however either my windows 7 or MT5 is stopping me gaining access to the custom indicator files so i have to post it like this. Hopefully this will work for you.
//| Momentum candles.mq5 |
//| by cja |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link "MQL5: automated forex trading, strategy tester and custom indicators with MetaTrader"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_plots 1
#property indicator_type1 DRAW_COLOR_CANDLES
#property indicator_color1 Green,Red,Gray
#property indicator_width1 3
#property indicator_label1 "Momentum Candles"
input int CandlePipValue = 10;
//--- indicator buffers
double ExtOBuffer[];
double ExtHBuffer[];
double ExtLBuffer[];
double ExtCBuffer[];
double ExtColorBuffer[];
//--- handles of indicators
//--- bars minimum for calculation
#define DATA_LIMIT 38
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,ExtOBuffer,INDICATOR_DATA);
SetIndexBuffer(1,ExtHBuffer,INDICATOR_DATA);
SetIndexBuffer(2,ExtLBuffer,INDICATOR_DATA);
SetIndexBuffer(3,ExtCBuffer,INDICATOR_DATA);
SetIndexBuffer(4,ExtColorBuffer,INDICATOR_COLOR_INDEX);
//---
IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- sets first bar from what index will be drawn
IndicatorSetString(INDICATOR_SHORTNAME,"Momentum Candles");
//--- don't show indicator data in DataWindow
PlotIndexSetInteger(0,PLOT_SHOW_DATA,false);
//--- sets first candle from what index will be drawn
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,DATA_LIMIT);
//--- get handles
//--- initialization done
}
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 &TickVolume[],
const long &Volume[],
const int &Spread[])
{
int i,limit;
//--- we can copy not all data
int to_copy;
if(prev_calculated>rates_total || prev_calculated<0) to_copy=rates_total;
else
{
to_copy=rates_total-prev_calculated;
if(prev_calculated>0) to_copy++;
}
//--- set first bar from what calculation will start
if(prev_calculated<DATA_LIMIT)
limit=DATA_LIMIT;
else
limit=prev_calculated-1;
double pipModifier=1;
if (_Digits==3 || _Digits==5) pipModifier=10;
//--- the main loop of calculations
for(i=limit;i<rates_total && !IsStopped();i++)
{
ExtOBuffer=Open;
ExtHBuffer=High;
ExtLBuffer=Low;
ExtCBuffer=Close;
//--- set color for candle
ExtColorBuffer=2.0; // set gray Color
//--- check for Green Zone and set Color Green
if(Open>Close && (Open-Close)>=CandlePipValue*_Point*pipModifier)
ExtColorBuffer=1.0;
//--- check for Red Zone and set Color Red
if(Open=CandlePipValue*_Point*pipModifier)
ExtColorBuffer=0.0;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Meta Trader 5 code working great thank you again !!!
I have not done much in the way of MT5 code but I have managed to get this to work ( see screenshot below ), however either my windows 7 or MT5 is stopping me gaining access to the custom indicator files so i have to post it like this. Hopefully this will work for you.
//| Momentum candles.mq5 |
//| by cja |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link "MQL5: automated forex trading, strategy tester and custom indicators with MetaTrader"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_plots 1
#property indicator_type1 DRAW_COLOR_CANDLES
#property indicator_color1 Green,Red,Gray
#property indicator_width1 3
#property indicator_label1 "Momentum Candles"
input int CandlePipValue = 10;
//--- indicator buffers
double ExtOBuffer[];
double ExtHBuffer[];
double ExtLBuffer[];
double ExtCBuffer[];
double ExtColorBuffer[];
//--- handles of indicators
//--- bars minimum for calculation
#define DATA_LIMIT 38
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,ExtOBuffer,INDICATOR_DATA);
SetIndexBuffer(1,ExtHBuffer,INDICATOR_DATA);
SetIndexBuffer(2,ExtLBuffer,INDICATOR_DATA);
SetIndexBuffer(3,ExtCBuffer,INDICATOR_DATA);
SetIndexBuffer(4,ExtColorBuffer,INDICATOR_COLOR_INDEX);
//---
IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- sets first bar from what index will be drawn
IndicatorSetString(INDICATOR_SHORTNAME,"Momentum Candles");
//--- don't show indicator data in DataWindow
PlotIndexSetInteger(0,PLOT_SHOW_DATA,false);
//--- sets first candle from what index will be drawn
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,DATA_LIMIT);
//--- get handles
//--- initialization done
}
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 &TickVolume[],
const long &Volume[],
const int &Spread[])
{
int i,limit;
//--- we can copy not all data
int to_copy;
if(prev_calculated>rates_total || prev_calculated<0) to_copy=rates_total;
else
{
to_copy=rates_total-prev_calculated;
if(prev_calculated>0) to_copy++;
}
//--- set first bar from what calculation will start
if(prev_calculated<DATA_LIMIT)
limit=DATA_LIMIT;
else
limit=prev_calculated-1;
double pipModifier=1;
if (_Digits==3 || _Digits==5) pipModifier=10;
//--- the main loop of calculations
for(i=limit;i<rates_total && !IsStopped();i++)
{
ExtOBuffer=Open;
ExtHBuffer=High;
ExtLBuffer=Low;
ExtCBuffer=Close;
//--- set color for candle
ExtColorBuffer=2.0; // set gray Color
//--- check for Green Zone and set Color Green
if(Open>Close && (Open-Close)>=CandlePipValue*_Point*pipModifier)
ExtColorBuffer=1.0;
//--- check for Red Zone and set Color Red
if(Open=CandlePipValue*_Point*pipModifier)
ExtColorBuffer=0.0;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Thank you for your quick response to this, I got the MT5 indicator working
just brilliant
Momentum candles 2
HELLO CJA,
Thanks for your skillful contributions.
I have been using the momentum candles and i have found out the momentum signals can be filtered to reduce some of the false signals by ADDING a 2nd rule based on pips difference between the LOW AND HIGH.
Can you please create this new version based on these rules ;
FOR GREEN CANDLE ;
(1) CLOSE IS ABOVE OPEN BY ...........X PIPS, and
(2) HIGH IS ABOVE LOW BY ...........X PIPS
FOR RED CANDLE ;
(1) CLOSE IS BELOW OPEN BY .......... X PIPS, and
(2) LOW IS BELOW HIGH BY ......... X PIPS
THANKS IN ADVANCE FOR YOUR ANTICIPATED RESPONSE.
Added High Low option
Try these, the MQL4 should be good and the MQL5 should be alright but I have not done enough MQL5 code to be sure.
If you want the indicators to give the same signals as the previous versions just set the High low pip value to smaller than the Candle pip value.
Mom candles 2
Hello cja,
thank you very much for your prompt response.
Add Alerts please
Simple but very useful indicator! great.
You can add display alerts and email alerts?
thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
when it comes to trading forex, we want to look for momentum to show us that the pair we are intrested in has any potential movement , I have been all over the internet looking for this simple indicator to show me when the candle has moved from the open price to the close price a certain amount of pips, I would like this candle to change colour, so lets say the price is just going sideways and we have no real momentum for what my setting is, say my setting was 15 pips on the 1 hour chart, so the open to close price was only around 8-10 pips , this would mean that the candles would remain with no colour on them, but as soon as the open to close price hits 15 pips or > than this, the candle would be painted green for and up candle or red for a down candle according to the minimum pip value that I have set it to.
this would be a great visual indicator, and would save me from trying to work out the candles body size , all i need to do is look visualy at the candle for my momentum trigger.
can someone please help me to create this indicator as i feel it would be a great help not only to me but to other people who have been searching for this.
thanks