suppose I want to enter a trade when one condition just occured and another occured in the last 4 bars. how do I code that? for example, if I want to buy if stochastic crosses above 20, and RSI crossed 30 in the last 3 bars, do I need to define RSI for the last 3 bars and then code that? can I use a for loop instead? but I don't know how to code the boolean logic using the for loop.
- [ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4.
- Opening 1 position, Confirming and not opening another in an EA
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
test for the stochastic if it is above 20 test the RSI in a for loop. Use the shift parameter in iRSI() with the for loop.
kinda like this
if(iStocs >20)
{for(i=0 .. etc
{if(iRSI(parameters,i) >30)
{bool flag=true;
}}}
Thanks! one more thing-what if I need a crossover? For example, if stochastic crossed with its signal line in the last 3 bars, we wont enter a buy.
1mathboy1: what if ...
Code it.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register