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
I suggest the following: attach indicator (the variant that worked before, without changes) here or in my personal message, I will correct it.
Hi, Pavlik!
That's the version.
original.
try dragging the code
pansa
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2.mq4
//| Ramdass - Conversion only
//+------------------------------------------------------------------+
#property copyright "Author - OlegVS, GOODMAN"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Chartreuse
#property indicator_color2 Yellow
#property indicator_width1 2
#property indicator_width2 2
//---- input parameters
extern int K=30;
extern double Kstop=0.5;
extern inttern Kperiod=150;
extern inttern PerADX=14;
extern inttern CountBars=350;
extern intON=1; //zakton's
//---- buffers
double val1[];
double val2[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function|
//+------------------------------------------------------------------+
int init()
{
string short_name;
//----indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
SetIndexBuffer(0,val1);
SetIndexBuffer(1,val2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2|
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars+PerADX);
SetIndexDrawBegin(1,Bars-CountBars+PerADX);
int i,shift,counted_bars=IndicatorCounted();
int i1,i2;
double Range,AvgRange,smin,smax,SsMax,SsMin,SSP,price;
bool uptrend,old;
//----
if(Bars<=PerADX+1) return(0);
//---- initial zero
if(counted_bars<PerADX+1)
{
for(i=1;i<=PerADX;i++) val1[CountBars-i]=0.0;
for(i=1;i<=PerADX;i++) val2[CountBars-i]=0.0;
}
//----
for (shift = CountBars-PerADX; shift>=0; shift--)
{
SSP=MathCeil(Kperiod/iADX(NULL,0,PerADX,PRICE_CLOSE,MODE_MAIN,1));
Range=0;
AvgRange=0;
for (i1=shift; i1<=shift+SSP; i1++)
{AvgRange=AvgRange+MathAbs (High[i1]-Low[i1]);
}
Range=AvgRange/(SSP+1);
SsMax=High[shift]; SsMin=Low[shift];
for (i2=shift;i2<=shift+SSP-1;i2++)
{
price=High[i2];
if(SsMax<price) SsMax=price;
price=Low[i2];
if(SsMin>=price) SsMin=price ;
}
smin = SsMin+(SsMax-SsMin)*K/100;
smax = SsMax-(SsMax-SsMin)*K/100;
val1[shift]=0;
val2[shift]=0;
if (Close[shift]<smin)
{
uptrend = false;
}
if (Close[shift]>smax)
{
uptrend = true;
}
if (uptrend!=old && uptrend==true) {val1[shift]=Low[shift]-Range*Kstop;}
if (uptrend!=old && uptrend==false) {val2[shift]=High[shift]+Range*Kstop;}
old=uptrend;
// zakton's code
if ((shift == 0) && (SoundON == 1)) {
if (val1[0] > 0) PlaySound("ReadyToExit.wav");
}
if ((shift == 0) && (SoundON == 1)) {
if (val2[0] > 0) PlaySound("ReadyToExit.wav");
}
}
return(0);
}
//+--------------------------------------------------------Hi, Pavlik!
That's the version.
original.
try dragging the code
pansa
Sr. Pansa! Porqué no usa el botón SRC para poner su código? Así mejor o Ud. tiene alguna duda?
Buena suerte!
Hi, Pavlik!
That's the version.
original.
try dragging the code
pansa
The indicator works, but the developer has made a logical error in it
OK?
OK?
Hi Pavlik!
Installed your code-
It works perfectly!
You're a great talent -
You've broken through the wall!
Great job -
now reliable signals and
♪ new horizons! ♪
what a good day today!
I'd like to give special thanks to Integer.
He wrote the player call script!
There are, however, talents and good people.
Kudos to you!
Today is 9/11/14!
Panza
Most of my rubbish warnings are generated because of a perfectly legal, correct and standard passing of a variable by reference into a function when the function's template name coincides with the variable itself as it should be in this construct in its standard and typical use, when the variable itself is passed into the function by its own name.
Give an example, please.
Unfortunately, the MC could not give a competent and logical explanation of this, as sometimes someone there allegedly may have a misunderstanding in other constructions when there are similar names.
If I understood the case correctly, the answer was both logical and correct, and was learned over more than a couple of decades of continuous programming.
Sorry for the accidentally erased comment - I clicked on the wrong place and there is no function to restore it.
Give me an example, please.
If I understood the case correctly, the answer was both logical and correct, and has been suffered through more than a couple of decades of continuous programming.
The editor generated the warning "declaration of 'a' hides global declaration at line 4" and "declaration of 'b' hides global declaration at line 4" for this standard, legal and popular construct by C language standards which is also incorrect and illiterate by its very essence because there is neither declaration of a new variable inside a function nor any hint at any possible variable overlapping.
As a result, we have hundreds of inappropriate warnings even in a not-so-large program code.
The indicator works, but the developer made a logical error in it
Hi Vinin!
You checked the indicator: AltrTrend_Signal_v2_2.mq4
and found a logical error
in formula : SSP=MathCeil (Kperiod/iADX(NULL,0,PerADX,PRICE_CLOSE,MODE_MAIN,1))
you underlined 1 at the end
what do you think it should be?
pansa