There are four external variables that will go into the command.
.
extern bool SoundON=true;
extern int AllBars=0;//Для скольки баров считать. 0 - для всех.
extern int Otstup=30;//Отступ.
extern double Per=9;//Период.
.
There are two index buffers
SetIndexBuffer(0,BufU);
SetIndexBuffer(1,BufD);
.
When BufU or BufD has a value, that's your signal.
The rest of the time the values are 0.
.
So, maybe something like this:
if(iCustom(Symbol(), 0, "BeginnerAlert", true, 0, 30, 9, 0, 0) != 0){
upsignal = true;
}
if(iCustom(Symbol(), 0, "BeginnerAlert", true, 0, 30, 9, 1, 0) != 0){
dnsignal = true;
}
Thank
you phy for your help.
Your idea works. Bye
Puncher,
I've been following this indicator closely and testing/playing around with it myself. If you do succeed in writing the EA for it, would you be willing to share it with me? My email is futures4me@aol.com
Thank You!
There are four external variables that will go into the command.
.
extern bool SoundON=true;
extern int AllBars=0;//Для скольки баров считать. 0 - для всех.
extern int Otstup=30;//Отступ.
extern double Per=9;//Период.
.
There are two index buffers
SetIndexBuffer(0,BufU);
SetIndexBuffer(1,BufD);
.
When BufU or BufD has a value, that's your signal.
The rest of the time the values are 0.
.
So, maybe something like this:
if(iCustom(Symbol(), 0, "BeginnerAlert", true, 0, 30, 9, 0, 0) != 0){
upsignal = true;
}
if(iCustom(Symbol(), 0, "BeginnerAlert", true, 0, 30, 9, 1, 0) != 0){
dnsignal = true;
}
Hi phy,
I wrote EA for this indicator but it opens only SELL orders. Never Buy roders. Something is wrong in your signals I think. Could you verify this problem?
.
.
.
int CheckForOpenPosition()
{int result=0, swieczka1=0, swieczka2=0;
if(iCustom(SYMBOL, 0, "BeginnerAlert", SoundON, AllBars, Otstup, Per, 0, 1) != 0) // buy signal true
{
swieczka1 = 1;
}
if(iCustom(SYMBOL, 0, "BeginnerAlert", SoundON, AllBars, Otstup, Per, 1, 1) != 0) //sell signal true
{
swieczka1 = -1;
}
if(iCustom(SYMBOL, 0, "BeginnerAlert", SoundON, AllBars, Otstup, Per, 0, 2) != 0) // buy signal true
{
swieczka2 = 1;
}
if(iCustom(SYMBOL, 0, "BeginnerAlert", SoundON, AllBars, Otstup, Per, 1, 2) != 0) //sell signal true
{
swieczka2 = -1;
}
if((swieczka1==0 || swieczka1==1) && swieczka2==1) // buy signal true
{
result = 1;
}
if((swieczka1==0 || swieczka1==-1) && swieczka2==-1) //sell signal true
{
result = -1;
}
return(result);
}
//+------------------------------------------------------------------------------------+
//| Opens position according to Beginner lert values |
//+------------------------------------------------------------------------------------+
void OpenPosition(int ShortLong, double Lots)
{
if(ShortLong == -1)
{
OrderSend(SYMBOL,OP_SELL,Lots,Bid,2,Ask+SL*Point,Ask-TP*Point,"Sprzedano",MAGICMA,0,Blue);
}
if(ShortLong == 1)
{
OrderSend(SYMBOL,OP_BUY,Lots,Ask,2,Bid-SL*Point,Bid+TP*Point,"Kupiono",MAGICMA,0,Red);
}
if(ShortLong != 0)
// LastBarTraded = Time[0];
return;
}
.
.
.
Please for HELP.
Regards,
Puncher
When does ShortLong get set to 1?
{
CheckForClosePositions();
CheckForModifyPositions();
if(TradeAllowed())
OpenPosition(CheckForOpenPosition(), Lots());
return(0);
}
/*
ShortLong = 1
when result = 1
*/
I tire of playing "guess how the code works" with you. Have a nice day.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The indicator is here: https://www.mql5.com/en/code/8359
Could you please tell me how can I reffer to this indicator on MQL code? iCustom(...
But what should I type there? When signal to buy and when signal to sell based on beginner alert indocator will occur?
Regards