Pls help me with this simple EA! Particularly, Buy oder function
I created a simple EA base on RSI and CCi! Besides, this EA will open order at bar's open price and close order at close price of the same bar or open price of next bar!
However, when i backtest it only work with sell order! Buy order didn't work
Pls help me
You should check your condition only on a new bar event and instead of Close[0] in your OrderSend use Bid at SELL and Ask at BUY.
Open[0] in your OrderSend function is Bid price and you can't use it at BUY (you have to use Ask price).
You should check your condition only on a new bar event and instead of Close[0] in your OrderSend use Bid at SELL and Ask at BUY.
If i use Bid or Ask, it would have a problem! As u see in this picture, i want to open order at 1 but it open at the middle of bar! Is there any other way to do it?
If i use Bid or Ask, it would have a problem! As u see in this picture, i want to open order at 1 but it open at the middle of bar! Is there any other way to do it?

I created a simple EA base on RSI and CCi! Besides, this EA will open order at bar's open price and close order at close price of the same bar or open price of next bar!
However, when i backtest it only work with sell order! Buy order didn't work
Pls help me