CODE HELP !!

 

Hi,

I have a problem.

I want my EA to trade many times as long as the parameters match.(Now it trades only once)

How can I do that?

 
Post the Code
 

M

> as long as the parameters match

Are you planning to send orders each second, minute or hour as long as the condition lasts - or what?

-BB-

 
BarrowBoy:

M

> as long as the parameters match

Are you planning to send orders each second, minute or hour as long as the condition lasts - or what?

-BB-

Hi BB

I would like the Ea to check every 30 minutes if RSi (14) is over 70 for SELL or under 30 for BUY


-Ionathan-

 

M

On the 30 min chart, you could do something like this OTTOMH - this just illustrates the BUY

     int ticket;

  if(iRSI("EURUSD",PERIOD_H1,14,PRICE_CLOSE,0)<30)

    {

     ticket=OrderSend("EURUSD",OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #1",16384,0,Green);

     if(ticket<0)

       {

        Print("OrderSend #1 failed with error #",GetLastError());

        return(0);

       }

    }
    
      if(iRSI("EURUSD",PERIOD_H1,14,PRICE_CLOSE,0)>70)

    {

     OrderClose(ticket,1,Ask,3,Red);

     return(0);

    }

keep in mind that an RSI period of 9 might be better than 14 on some pairs,

also that the 30/70 levels dont apply to all pairs/timeframes, i.e. 20/80 might work better or some other combination.

Finally, I would be more likely to use RSI as part of a Close or 'do not open' calculation, rather than an Open signal.
The Open logic is usually limited to, say, RSI coming back down through 70 for a sell - simply having it go over 70 for a sell may not be profitable...

As ever, my 2c worth!

-BB-

Reason: