
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
Good morning to all.
I have seen many versions of this indicator and red candles I never appear, could correct the error ????.
Thank you very much.
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
//---- indicator buffers
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
//----
double CB = 0, valueh1 = 0, valuel = 0, valueh = 0, value = 0, price = 0, hi = 1, lo = 1;
double resh = 0, resl = 0, deltah = 0, deltal = 0;
int CurrentBar=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 1 additional buffer used for counting.
IndicatorBuffers(3);
//---- drawing settings
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS) + 1);
SetIndexDrawBegin(0, 34);
SetIndexDrawBegin(1, 34);
//---- 3 indicator buffers mapping
if(!SetIndexBuffer(0, ind_buffer1) &&
!SetIndexBuffer(1, ind_buffer2) &&
!SetIndexBuffer(2, ind_buffer3))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("DeltaForce");
SetIndexLabel(0, "DF1");
SetIndexLabel(1, "DF2");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Delta Force |
//+------------------------------------------------------------------+
int start()
{
for(CB = 0 ; CB <= Bars ; CB++)
{
CurrentBar = Bars - CB;
if(Close[CurrentBar] > Close[CurrentBar+1])
{
resl = 0;
if(resh == 0)
deltah = 0;
deltah = deltah + (Close[CurrentBar] - Close[CurrentBar+1]);
// valueh = High[CurrentBar];
resh= 1;
}
if(resh == 0)
deltah = 0;
ind_buffer1[CurrentBar] = deltah;
if(Close[CurrentBar] < Close[CurrentBar+1] )
{
resh = 0;
if(resl == 0)
deltal = 0;
deltal = deltal + (Close[CurrentBar+1] - Close[CurrentBar]);
//valuel = Low[CurrentBar];
resl= 1;
}
if(resl == 0 )
deltal=0;
ind_buffer2[CurrentBar] = deltal;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
Good morning to all.
I have seen many versions of this indicator and red candles I never appear, could correct the error ????.
Thank you very much.
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
//---- indicator buffers
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
//----
double CB = 0, valueh1 = 0, valuel = 0, valueh = 0, value = 0, price = 0, hi = 1, lo = 1;
double resh = 0, resl = 0, deltah = 0, deltal = 0;
int CurrentBar=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 1 additional buffer used for counting.
IndicatorBuffers(3);
//---- drawing settings
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS) + 1);
SetIndexDrawBegin(0, 34);
SetIndexDrawBegin(1, 34);
//---- 3 indicator buffers mapping
if(!SetIndexBuffer(0, ind_buffer1) &&
!SetIndexBuffer(1, ind_buffer2) &&
!SetIndexBuffer(2, ind_buffer3))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("DeltaForce");
SetIndexLabel(0, "DF1");
SetIndexLabel(1, "DF2");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Delta Force |
//+------------------------------------------------------------------+
int start()
{
for(CB = 0 ; CB <= Bars ; CB++)
{
CurrentBar = Bars - CB;
if(Close[CurrentBar] > Close[CurrentBar+1])
{
resl = 0;
if(resh == 0)
deltah = 0;
deltah = deltah + (Close[CurrentBar] - Close[CurrentBar+1]);
// valueh = High[CurrentBar];
resh= 1;
}
if(resh == 0)
deltah = 0;
ind_buffer1[CurrentBar] = deltah;
if(Close[CurrentBar] < Close[CurrentBar+1] )
{
resh = 0;
if(resl == 0)
deltal = 0;
deltal = deltal + (Close[CurrentBar+1] - Close[CurrentBar]);
//valuel = Low[CurrentBar];
resl= 1;
}
if(resl == 0 )
deltal=0;
ind_buffer2[CurrentBar] = deltal;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+Try it out now : _test.mq4
Stanwell,
A couple pictures showing all that would help.
Big BeHi Big Be,
Good point, I will post a few charts tomorrow.
cheers,
Stan
Here is the AUD chart that I marked manually. Red boxes are the overlapping bars. On the left, there is a square which shows only three bars inside it, so doesn't fit the definition. However, if this leg is significant, say greater than 6 X ATR, I would count them as a swing as well (just hard to trade with only three bars), but thought this requirement would complicate coding so we can leave it out for the time being.
thx.
Stan
Hi Mladen and Mrtools !
I need your help again,are you able add a visual /acoustic alert to this indicator please ?
Thanks in advance,cheers !
MLADEN, good morning.
Thank you so much, have tried their _test and right appears.
Any help I have here, although its dominance is much more than mine, though in ProRealTime / VISUALCHART yes I can help more.
Best regards.
Hi,
i have an indicator and i want to limit the bars calculation.
The original code was:
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);[/CODE]
i changed it with this:
[CODE]int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(NBars-counted_bars,NBars-1);Is it correct? The indicator seems to work fine but i have doubt if i really have limited the bars calculation.
Hi,
i have an indicator and i want to limit the bars calculation.
The original code was:
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);[/CODE]
i changed it with this:
[CODE]int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(NBars-counted_bars,NBars-1);thefxpros
No. Do it like this :
int limit = MathMin(MathMin(Bars-counted_bars,Bars-1),NBars);
But in that case you always have to make sure that NBars is always > 0
Hi mladen
if you can help me,add the X and Y axes,then I can put in it to the corner,
and can adjust the font size,sorry for my English.
!X2014-PIPSv2
thx a lot.
Hi mladen
if you can help me,add the X and Y axes,then I can put in it to the corner,
and can adjust the font size,sorry for my English.
!X2014-PIPSv2
thx a lot.blueface
You already have them : posX and posY variables in the code