Page 33 of 181
Re: Coding Help
Posted: Tue May 23, 2017 4:48 am
by mladen
Newton51 wrote: Sun May 21, 2017 2:46 pm
I have this Deltaforce Indicator in ex4 format and it works perfectly. But the MQ4 when compiled will only show the positive values. I have been trying to find a working copy but found several references to this same phenomenon. It has been corrected by mladen but it is impossible to download because of some error.
Would it be possible to correct this version or post a working copy please??
Code: Select all
//+--------------------------------------------------------------------------------------+
//| Delta Force.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| |
//+--------------------------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link --------------------------------------------------
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 MediumSeaGreen
#property indicator_color2 Crimson
//---- 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, 3);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 3);
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);
}
//+------------------------------------------------------------------+
Newton51
Try it out now
Re: Coding Help
Posted: Tue May 23, 2017 9:29 am
by MrPip
Newton51 wrote: Sun May 21, 2017 2:46 pm
I have this Deltaforce Indicator in ex4 format and it works perfectly. But the MQ4 when compiled will only show the positive values. I have been trying to find a working copy but found several references to this same phenomenon. It has been corrected by mladen but it is impossible to download because of some error.
Would it be possible to correct this version or post a working copy please??
Code: Select all
//+--------------------------------------------------------------------------------------+
//| Delta Force.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| |
//+--------------------------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link --------------------------------------------------
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 MediumSeaGreen
#property indicator_color2 Crimson
//---- 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, 3);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 3);
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 this.
Re: Coding Help
Posted: Tue May 23, 2017 12:01 pm
by Newton51
mladen and MrPip, thankyou both very much for resolving this. I can see the section removed and deduce the problem area causing the issue. It now works properly. I learn new things every day. It's good for our brain :-) MrPip, thanks too for the innovation / modification to how the histogram displays.
Thanks again.
Re: Coding Help
Posted: Tue May 23, 2017 10:31 pm
by yamahaqs300
I have this indicator and I ask..if can show arrow one candle behind .... I don`t know if can be done .(He appear one candle later.Is a very good indicator..but appear one candle later
Thank you
Re: Coding Help
Posted: Tue May 23, 2017 10:57 pm
by mladen
yamahaqs300 wrote: Tue May 23, 2017 10:31 pm
I have this indicator and I ask..if can show arrow one candle behind .... I don`t know if can be done .(He appear one candle later.Is a very good indicator..but appear one candle later
Thank you
As far as that attached indicator is concerned, it is working as it should
Check the "LJ_SIG" indicator (that is called from that indicator) to see how that indicator works since probably the issue is in that indicator
Re: Coding Help
Posted: Tue May 23, 2017 11:09 pm
by yamahaqs300
mladen wrote: Tue May 23, 2017 10:57 pm
As far as that attached indicator is concerned, it is working as it should
Check the "LJ_SIG" indicator (that is called from that indicator) to see how that indicator works since probably the issue is in that indicator
Thank you ! Found it

Re: Coding Help
Posted: Wed May 24, 2017 5:18 pm
by mladen
yamahaqs300 wrote: Tue May 23, 2017 11:09 pm
Thank you ! Found it
Happy trading

Re: Coding Help
Posted: Thu May 25, 2017 3:40 am
by traderduke
mladen
I'm trying to get a trend sign from 35_MA_Squize. I got the "trend= 0" to work when the delta is less then the diff but I cant get the trend = 1 or -1 to work when the delta is more then the diff && ma1 is > then ma2. I left my efforts their ,commented out, so you can tell me where I went wrong. See lines 139ish
thank you
Ray
Re: Coding Help
Posted: Thu May 25, 2017 4:15 am
by mladen
traderduke wrote: Thu May 25, 2017 3:40 am
mladen
I'm trying to get a trend sign from 35_MA_Squize. I got the "trend= 0" to work when the delta is less then the diff but I cant get the trend = 1 or -1 to work when the delta is more then the diff && ma1 is > then ma2. I left my efforts their ,commented out, so you can tell me where I went wrong. See lines 139ish
thank you
Ray
rk-ml-35_MA_SquizeMA_Ed_FLET_colorMod nmc v2.mq4
Ray
Try it out now
Re: Coding Help
Posted: Thu May 25, 2017 4:57 am
by traderduke
mladen wrote: Thu May 25, 2017 4:15 am
Ray
Try it out now
Mladen
Thank you , I was one symbol away from success but long way from working.
Thank again
Ray