English

 34 Stan4o1 2015.12.25 22:37   Hi guys im here with the typical problem again im trying some code but the EA doesnt trade when the `Rsi1<=70` code is in. ```double Rsi0 = iRSI(NULL,0,14,PRICE_CLOSE,0); double Rsi1 = iRSI(NULL,0,14,PRICE_CLOSE,1); if (Rsi0>70 && Rsi1<=70 &&  Bid=30`
 Moderator3404 GumRai 2015.12.25 23:42 #   `if (Rsi0>70 && Rsi1<=70 &&  Bid
 34 Stan4o1 2015.12.26 09:32 #   ```if (Rsi0<30 && Rsi1>=30  && Close[1]>Open[1] && Ask>Close[1] ) ```This is the buy code. The sell code`s purpose is to open position  when the Rsi reverses and the price bellow the close of the previous one. The buy code has the same structure but it trades.  Thanks for the help GumRai
 Moderator3404 GumRai 2015.12.26 13:56 #   Depending on whether you are checking these conditions only at the open of a new bar or not, then your buy condition is more likely to be true than the sell condition.`BidClose[1]` In both conditions, Close[1] is the Bid price, in the first you are comparing Bid with Bid, in the 2nd Ask with Bid.As Ask is always larger than the Bid, the 2nd condition is more likely to be true.
 34 Stan4o1 2015.12.26 14:39 #   Im not trying to check only at the beginning of the new bar, but whenever the price breaks above the close of the previous bar(if the close is above the open) for buy and the oppposite for sell, How to change the code to achieve that?
 120 DeanDeV 2015.12.26 16:01 #   Stan4o1: Im not trying to check only at the beginning of the new bar, but whenever the price breaks above the close of the previous bar(if the close is above the open) for buy and the oppposite for sell, How to change the code to achieve that? Rather use Ask for sell orders and Bid for buy orders as triggers to accommodate for the spread... Haven't checked, but it should trade if those conditions are met.```if(Rsi1<=70 && Rsi0>70) if(Close[1]=30 && Rsi0<30) if(Close[1]>Open[1] && Bid>Close[1])     //Buy orders```
 34 Stan4o1 2015.12.26 18:41 #   Thanks ;)
 Moderator3404 GumRai 2015.12.26 21:18 #   DeanDeV: Rather use Ask for sell orders and Bid for buy orders as triggers to accommodate for the spread... Haven't checked, but it should trade if those conditions are met.In my opinion, it is illogical to compare Ask with any chart price as the chart price is always Bid, Therefore all chart price comparisons should be with Bid
 34 Stan4o1 2015.12.27 10:15 #   This is good to know, Thank you