RSI Filter - page 2

To add comments, please log in or register
PieroNetto
292
PieroNetto  
RaptorUK:
So exactly what is your problem ?

Thanks Raptor!

Im trying to implement an Rsi filter that allows me to use per choise, Use RSI=true or false.

Allows long trade when rsi>50 and short when rsi<50

RSI=false it should not turn of the existing EA 

Is just an extra filter per choise 

Simon Gniadkowski
17644
Simon Gniadkowski  
pieronetto:

Thanks Raptor!

Im trying to implement an Rsi filter that allows me to use per choise, Use RSI=true or false.

Allows long trade when rsi>50 and short when rsi<50

RSI=false it should not turn of the existing EA 

Is just an extra filter per choise 

Yes I know,  but when you run your code what is it not doing that it should or what is it doing that it shouldn't ?
PieroNetto
292
PieroNetto  
RaptorUK:
Yes I know,  but when you run your code what is it not doing that it should or what is it doing that it shouldn't ?

If(UseRsi)=false the existing EA wont open any trades but he should

 and when if(UseRsi)=true the EA works normal and the rsi filter does nothing.

extern bool      UseRSI=true;
extern int       RSIperiod=14;
extern double    RSIBuyPoint=50;
extern double    RSISellPoint=70;
bool BuyRSI,SellRSI;
int start()
{ 
    if (UseRSI)  
  {     
     double RSI  = iRSI(NULL,0,RSIperiod,PRICE_OPEN,0);
     if (RSI > RSIBuyPoint)
     BuyRSI=false;
     else
     BuyRSI=true;
     if (RSI < RSISellPoint)
     SellRSI=false;
     else
     SellRSI=true;
   }
  }
// before OrderSend 
    if (BuyRSI)
    if(SellRSI)
   return(0);
   
Simon Gniadkowski
17644
Simon Gniadkowski  
pieronetto:

If(UseRsi)=false the existing EA wont open any trades but he should

 and when if(UseRsi)=true the EA works normal and the rsi filter does nothing.


If UseRsi is false then BuyRSI and SellRSI are still at their default values . . .  it also looks like you have one too many braces . .

extern bool      UseRSI=true;
extern int       RSIperiod=14;
extern double    RSIBuyPoint=50;
extern double    RSISellPoint=70;
bool BuyRSI,SellRSI;
int start()
   { 
   if (UseRSI)  
      {     
      double RSI  = iRSI(NULL,0,RSIperiod,PRICE_OPEN,0);
      if (RSI > RSIBuyPoint)
         BuyRSI=false;
      else
         BuyRSI=true;
      if (RSI < RSISellPoint)
        SellRSI=false;
      else
        SellRSI=true;
      }
   }                       //  this is the closing brace for the start function
 
   // before OrderSend 
   if (BuyRSI)            //  this is outside of start()
      if(SellRSI)
         return(0);
PieroNetto
292
PieroNetto  

Thanks to Raptor again i got it working so far.

only if i put rsi=false the rest of the EA wont open any trades.

Please a litle hint. I like to have the rest of the EA working if i put rsi=false.

Thanks 

extern bool      UseRSI=true;  
extern int       RSIperiod=14;    //rsi period
extern double    RSIBuyPoint=51;  //allow long entry above or equal RSIBuyPoint
extern double    RSISellPoint=49; //allow short entry beneath or equal RSISellPoint

bool BuyRSIAllowTrading,SellRSIAllowTrading;

{     
    if (UseRSI)  
  {     
     double RSI  = iRSI(NULL,0,RSIperiod,PRICE_OPEN,0);
     if (RSI<RSIBuyPoint)
     BuyRSIAllowTrading=false;
     else
     BuyRSIAllowTrading=true;
     if (RSI>RSISellPoint)
     SellRSIAllowTrading=false;
     else
     SellRSIAllowTrading=true;
}
}   
   //  if(BuyRSIAllowTrading).......put in to buy conditions
   //  if(SellRSIAllowTrading)......put in to sell conditions
PieroNetto
292
PieroNetto  
pieronetto:

Thanks to Raptor again i got it working so far.

only if i put rsi=false the rest of the EA wont open any trades.

Please a litle hint. I like to have the rest of the EA working if i put rsi=false.

Thanks 

 

Happy holidays everyone
Simon Gniadkowski
17644
Simon Gniadkowski  
pieronetto:

Thanks to Raptor again i got it working so far.

only if i put rsi=false the rest of the EA wont open any trades.

Please a litle hint. I like to have the rest of the EA working if i put rsi=false.

You need to show more of your code . . .  we can't see how you are using your bools in relation to opening trades . . .
PieroNetto
292
PieroNetto  
RaptorUK:
You need to show more of your code . . .  we can't see how you are using your bools in relation to opening trades . . .

Here are my sell and buy conditions i believe ths change need to be made here.

Thanks for beeing on today.

void CheckForOpen() {
   int    res,tr;
//---- sell conditions
   if(SellRSIAllowTrading)  
   if(sellsig){
           if (co==0 && lastsig!=Time[0]) {
             res = OpenAtMarket(OP_SELL,lot);
             lastsig=Time[0];
           }
      return;
   }
//---- buy conditions
   if(BuyRSIAllowTrading)
   if(buysig){
           if (co==0 && lastsig!=Time[0]) {
             res = OpenAtMarket(OP_BUY,lot);
             lastsig=Time[0];
           }
      return;
   }
}
Simon Gniadkowski
17644
Simon Gniadkowski  
pieronetto:

Here are my sell and buy conditions i believe ths change need to be made here.

Thanks for beeing on today.

 

Why wouldn't I be here today ?

 

As I said before . . .

RaptorUK:

If UseRsi is false then BuyRSI and SellRSI are still at their default values . . .  

 . . .  but you have changed the variable names.

Look at this and understand why it will work . . .

void CheckForOpen() {
   int    res,tr;
//---- sell conditions
   if(SellRSIAllowTrading || !UseRSI)    // changed this line 
      if(sellsig){
           if (co==0 && lastsig!=Time[0]) {
             res = OpenAtMarket(OP_SELL,lot);
             lastsig=Time[0];
           }
      return;
   }
//---- buy conditions
   if(BuyRSIAllowTrading || !UseRSI)   // changed this line
      if(buysig){
           if (co==0 && lastsig!=Time[0]) {
             res = OpenAtMarket(OP_BUY,lot);
             lastsig=Time[0];
           }
      return;
   }
}
PieroNetto
292
PieroNetto  
RaptorUK:

Why wouldn't I be here today ?

 

As I said before . . .

 . . .  but you have changed the variable names.

Look at this and understand why it will work . . .

Thank you very much it works  now just fine but i do not understand the code line please point me to some text i can read about it.

thanks again. 

123
To add comments, please log in or register