
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
thx but can you explain me why
BuyCondition = BuyValueCurrent1 != EMPTY_VALUE
why empty_value?
anyway it doesn't work and i don't understand and figure out why..
here are my variables
and here is the statement
[PHP] BuyCondition = (BuyValueCurrent != EMPTY_VALUE && BuyValueCurrent2 != EMPTY_VALUE);it gives totally fuzzy results even when the indicator (Braintrend2stop and BrainTrend1Stop) are SELL
i have an EA wich open and mange the position, but sometimes give the indikator the same signal multiple and the EA open everytime this signal comes out an new position - but i dont want a second or third and so on and on position, i will only the first one - is it possible that the EA checks the open position by the basis of the magic number and pair to avoid such multiple entrys ?
Here's the idea:
{
int count=0;
int trade;
int trades=OrdersTotal();
for(trade=0;trade<trades;trade++) {
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol() || OrderMagicNumber() != MagicNumber) continue;
if(OrderType()==OP_BUY) count++;
} //---- for
return(count);
}
int CountShorts()
{
int count=0;
int trade;
int trades=OrdersTotal();
for(trade=0;trade<trades;trade++) {
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol() || OrderMagicNumber() != MagicNumber) continue;
if(OrderType()==OP_SELL) count++;
} //---- for
return(count);
}And in the start() function:
if(CountLongs() == 0 && CountShorts() == 0) {
Your entry condition here
}Hope that helps.
FerruFx
anyway it doesn't work and i don't understand and figure out why..
here are my variables
and here is the statement
[PHP] BuyCondition = (BuyValueCurrent != EMPTY_VALUE && BuyValueCurrent2 != EMPTY_VALUE);I do not know your indic Braintrend1 and 2, I just assumed that when a buy condition is fulfilled, they draw an arrow on the chart. In MT4, the default buffer's value is a constant named "EMPTY-VALUE", so if there is no arrow the value returned by iCustom() is this constant, and if there is an arrow the returned value is the price where the arrow is put.
As I understood, you want to buy when both indics are showing an arrow, isn't that ?
yes is exactly what i want to do
yes is exactly what i want to do
So, please, check your iCustom() syntax.
what i have to check? maybe i miss something
well for what i suppose if there is a buy signal it is stored in buffer 0 else it is empty and buffer 1 has the sell signal
what i have to check? maybe i miss something
Post your indic here, I will look.
ok thx!
and please explain
ok thx! and please explain
Open BrainTrend1Stop.mq4.
At the begining of the file you can find :
extern int EnableAlerts=0;
extern int SignalID=0;[/PHP]This means that you have to fill those three parameters as arguments in the iCustom() call, like this:
[/PHP]About the buffer's number, you can see this:
#property indicator_color2 Aqua[/PHP]So the buffer 0 is Magenta and the buffer 1 is Aqua.
Thus if the Buy arrow's color is Aqua, the buffer's number is 1 and the iCustom call is:[PHP]BuyValueCurrent = iCustom(NULL,0,"BrainTrend1Stop",NumBars,EnableAlerts,SignalID,1,1); // braintrend1This means that the default empty value for the buffer 1 is set to 0.0; so when there is no arrow, the value returned by the iCustom() call will be 0.0.
So you should know the presence of the arrow checking its value against 0, like this (if the second indic follows the same behavior):[PHP]BuyCondition = (BuyValueCurrent > 0 && BuyValueCurrent2 > 0);About the second indic, I think you should be able to do the same analyse by yourself.