
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
Dear all guru,
void calculateRanges()
{
g_bar1Range = MathAbs( High[ 1 ] - Low[ 1 ] );
g_bar2Range = MathAbs( High[ 2 ] - Low[ 2 ] );
g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );
if( MathAbs( g_bar1Body ) < EPSILON )
Can I ask this code calculate the last candle range (g_bar1range) and 2 candle stick before the current candlestick (g_bar2range)? Am i correct?
Thank you in advance.This line calculates the range between the High and Low of the previous bar (bar 1).
This line calculates the range between the High and Low of the previous previous bar (bar 2).
[PHP]g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );This line calculates the Body length of the previous bar (bar 1).
Please help!
An OP_BUYSTOP order has been activated, I want to put an op_sellstop order at the same position, how should I program.( what command could detect an pending order has been activated and price).Thanks.
after an order actived how to put an pending opposite order at the same position
I am doing grid trading.total 8 buystop and 8 sellstop.after an OP_BUYSTOP order has been activated,the buystop orders are random at start. I want to put an op_sellstop order at the same position, how should I program.it is unefficint if using for/while to check( is there any command could detect an pending order has been activated and price).Thanks in advance.
progammation help
Hello
I would like to know how to put this into an Expert Advisor:
When my expert advisor is connected I would like to receive an email?.
Put a password?
After a certain date my expert advisor stops
thank you
Reverse Orders
Hi, I would ask the programmers of this forum if I can change these 2 EA "Fx Prime2 hieken ashi.mq4" and "Heiken Ashi Bar Ea v1.0.mq4" working with this indicator Heiken_Ashi_Smoothed "so that open orders on the other hand ... so instead of BUY and SELL opens the contrary, I wonder why inverting only with OP_BUY OP_SELL wrong and I can not find what I need to change to make them work on the contrary, I thank you in advance.
Amount of passed parameters cannot exceed 64
Comment("Account free margin is ",DoubleToStr(free,2),"\n","Current time is ",TimeToStr(TimeCurrent()));
there is 5 parameters in that line
"\n", is a parameter, it is a string
so yes, the limit is 64, every new line consumes 1
")"- wrong parameters count error
as for the error
at the bottom, dbl click it, your cursor should move to the line of code where the error is
unless your missing or have to many of these {}
in that case the cursor will move to the next function after the error, or the end of the code
Hi coders,
In the "comment" text in an EA, is there any maximum "\n" comment lines ?
Compiling I have a ")"- wrong parameters count error.
What does this mean ?
Thanks a lot
Tomcatg_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );that could return a negative number
what if open is below close
if (Open[ 1 ] > Close[ 1 ] ) g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );
if (Open[ 1 ] < Close[ 1 ] ) g_bar1Body = MathAbs( Close[ 1 ] - Open[ 1 ] );
incase you didnt notice
0=current bar
1=previouse bar
2=2 bars back
and so on
Dear all guru,
void calculateRanges()
{
g_bar1Range = MathAbs( High[ 1 ] - Low[ 1 ] );
g_bar2Range = MathAbs( High[ 2 ] - Low[ 2 ] );
g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );
if( MathAbs( g_bar1Body ) < EPSILON )
Can I ask this code calculate the last candle range (g_bar1range) and 2 candle stick before the current candlestick (g_bar2range)? Am i correct?
Thank you in advance.g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );that could return a negative number
what if open is below close
if (Open[ 1 ] > Close[ 1 ] ) g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ] );
if (Open[ 1 ] < Close[ 1 ] ) g_bar1Body = MathAbs( Close[ 1 ] - Open[ 1 ] );
incase you didnt notice
0=current bar
1=previouse bar
2=2 bars back
and so onMathAbs returns the absolute number (the number without - minus)
So if Open is greater or lesser than the Close the result is the same for:
g_bar1Body = MathAbs( Open[ 1 ] - Close[ 1 ]
"\n" comment lines
Hi tomhliles,
I thank you very much.
I better understand now.
Thanks a lot.
Tomcat
Adding a invert histogram option
Hi,
Could someone help me with the code to add a invert option ,
so when you have is up against the eurusd or the usdchf you have a better
of what is going on
Thank you for any help
//+------------------------------------------------------------------+
//| usdx histo |
//| usdx histo.mq4 |
//| |
//+------------------------------------------------------------------+
#property copyright "copyleft mladen"
#property link "mladenfx@gmail.com"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 DimGray
#property indicator_width3 2
//
//
//
//
//
extern int SmoothPeriod = 4;
extern bool ShowHisto = true;
//
//
//
//
//
double gbuffer[];
double rbuffer[];
double mbuffer[];
double wbuffer[];
string symbols[] = {"EURUSD","USDJPY","GBPUSD","USDCAD","USDSEK","USDCHF"};
double weights[] = {-0.576,-0.136,-0.119,-0.091,-0.042,-0.036};
bool divide[] = {false,true,false,true,true,true};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
IndicatorBuffers(4);
SetIndexBuffer(0,rbuffer); SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(1,gbuffer); SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(2,mbuffer);
SetIndexBuffer(3,wbuffer);
IndicatorShortName("USDX ");
return(0);
}
//
//
//
//
//
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//
//
//
//
//
for(i=limit; i>=0; i--)
{
double product = 0.00;
bool error = false;
//
//
//
//
//
mbuffer = EMPTY_VALUE;
wbuffer = EMPTY_VALUE;
for (int k=0; k<6; k++)
{
double rateWeight = rateWeight(i,k,error);
if ( error ) break;
if ( product == 0.00)
product = rateWeight;
else product *= rateWeight;
}
if ( error ) continue;
//
//
//
//
//
wbuffer = product*50.14348112;
mbuffer = smooth(i,SmoothPeriod);
if (ShowHisto)
{
rbuffer = rbuffer;
gbuffer = gbuffer;
if (mbuffer > mbuffer) { gbuffer = mbuffer; rbuffer = EMPTY_VALUE; }
if (mbuffer < mbuffer) { rbuffer = mbuffer; gbuffer = EMPTY_VALUE; }
}
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
double rateWeight(int i, int k, bool& error)
{
double price = iClose(symbols[k],0,i);
double weight = 0.00;
if (price == 0) { error = true; return(0); }
if (divide[k])
weight = 1/price;
else weight = price;
return(MathPow(weight,weights[k]));
}
//
//
//
//
//
#define Pi 3.141592653589793238462643
double smoothCoeffs[];
double smoothDivisor;
bool smoothInitialized = false;
int smoothLength = 0;
//
//
//
//
//
double smooth(int i, int length)
{
//
//
//
//
//
if (!smoothInitialized || length != smoothLength)
{
smoothInitialized = true;
smoothLength = MathMax(length,1);
//
//
//
//
//
ArrayResize(smoothCoeffs, smoothLength);
smoothCoeffs[0] = 1;
smoothDivisor = 1;
for (int k = 1; k < smoothLength; k++)
{
double temp = 1 << k / Pi;
smoothCoeffs[k] = MathSin(temp) / temp;
smoothDivisor += smoothCoeffs[k];
}
}
//
//
//
//
//
double sum = 0;
for (int l = 0; l < smoothLength; l++) sum += wbuffer[l+i]*smoothCoeffs[l];
return(sum/smoothDivisor);
}