Hey all,
i've written a small code and all is working but this condition is not, i don't know if i have coded it wrong or i'm missing something if you can help me
What i'm aiming in this condition is that "If the new candle closes higher than the previous one, and if the RSI is higher than the previous one, place BUY"
but it's not doing so, is there something wrong with what i've wrote?
When the subject matter is MQL4 please post in the correct section. I will move this topic there.
RSI = iRSI(NULL,0,RSI_period,RSI_applied_price,1); if((iBarShift(NULL,0,SignalCandle) > 0) && (isTradingAllowed())){ if((iClose(NULL,0,1) > iOpen(NULL,0,0)) && (iRSI(NULL,0,14,PRICE_OPEN,0) > RSI)){ OpenBuy(); SignalCandle = iTime(NULL,0,0);
Your 2 iRSI calls have different parameters (although they may happen to be the same depending on the inputs.)
"If
the new candle closes higher than the previous one, and if the RSI is higher than the previous one, place BUY"
if((iClose(NULL,0,1) > iOpen(NULL,0,0)) && (iRSI(NULL,0,14,PRICE_OPEN,0) > RSI))You are checking if the previous close is higher than the open price of the current bar.
When the subject matter is MQL4 please post in the correct section. I will move this topic there.
Your 2 iRSI calls have different parameters (although they may happen to be the same depending on the inputs.)
You are checking if the previous close is higher than the open price of the current bar.Thank you for your explanation it really helped me, if i use the below, is it right?
(iClose(NULL,0,0) > NormalizeDouble((iOpen(NULL,0,1) + (5*Point())),Tick_Decimals))
That if the open is 5 points higher than the close
What i'm aiming in this condition is that "If the new candle closes higher than the previous one, and if the RSI is higher than the previous one, place BUY"
That if the open is 5 points higher than the close
You need to make up your mind what you are trying to do.
(iClose(NULL,0,0) > NormalizeDouble((iOpen(NULL,0,1) + (5*Point())),Tick_Decimals))
Here you are checking if the current price is more than 5 points higher than the open of the previous closed bar. Neither of the above scenarios.
You need to make up your mind what you are trying to do.
Here you are checking if the current price is more than 5 points higher than the open of the previous closed bar. Neither of the above scenarios.
So if i implement this code, will it check if the price gets 5 points higher to do what i tell it to? or will it check the moment the new candle open to match the OPEN PRICE with CLOSE PRICE?
The thing is that i'm testing to see which will be better for the EA, to compare the CLOSE PRICE < NEW CANDLE CLOSE PRICE , or to compare the CLOSE PRICE < NEW CANDLE OPEN PRICE
either way i'm trying to tell the EA that this candle is higher than the one before.
- Decide what you want it to do in concrete terms — without that, you can't code it.
- Code it to do what you want. It will only do what you code it.
- Decide what you want it to do in concrete terms — without that, you can't code it.
- Code it to do what you want. It will only do what you code it.
What i'm trying to do with the code is that "if the current candle price is got +5 higher than the previous closed candle, and the current RSI is higher than the previous candle"
i've read and searched through the forum and found some functions such as MarketInfo, MqlTick and SymbolInfoTick and i don't know if they are suitable for what i'm looking for or not.
Such as the below is this correct command to fulfill my need? or am i still missing something
RSI = iRSI(NULL,0,RSI_period,RSI_applied_price,1); PriceBid = MarketInfo(0,MODE_BID) if((iBarShift(NULL,0,SignalCandle) > 0) && (isTradingAllowed())){ if((iClose(NULL,0,1) < PriceBid) && (iRSI(NULL,0,14,PRICE_OPEN,0) > RSI)){ OpenBuy(); SignalCandle = iTime(NULL,0,0);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey all,
i've written a small code and all is working but this condition is not, i don't know if i have coded it wrong or i'm missing something if you can help me
What i'm aiming in this condition is that "If the new candle closes higher than the previous one, and if the RSI is higher than the previous one, place BUY"
but it's not doing so, is there something wrong with what i've wrote?