if (Rsi0>70 && Rsi1<=70 && Bid<Close[1] && Close[1]<Open[1])
As this condition requires the RSI to cross above the 70 level at the same time as price falls, the condition will not be met often.
What is the code for the buycondition?
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
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.
Bid<Close[1]
Ask>Close[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.
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]<Open[1] && Ask<Close[1]) //Sell orders if(Rsi1>=30 && Rsi0<30) if(Close[1]>Open[1] && Bid>Close[1]) //Buy orders
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Rsi1<=70
code is in. if the code i said before is in the if statement it does not trade, if it isnt it trades. I have a similar if construction for buy orders , in it i have similar code like the one bellow, but it trades and I wonder why My code doesnt trade with the mentioned code, I still dont figure out why, i used print but everything is ok , Can u help me ?Rsi1>=30