if rsi is above 85 do not buy if it will around 60 to 85 range it should be buy only if this 85 comes after 30-45-60 and 85 sell not like 65-50-70-75-80-70-85 so not sell same for but also
not buy if RSIi is around 20 like 15-20-10-15-30-20-22 but buy if rsi is continue to go below like 70-60-40-20 then buy.
Edit - MyfirstEA and add the following control(s) concept as needed
Your code would look something like and written for clarity.
staticbool AllowBuy = true ;
if ( Buytrigger()==true && AllowBuy==true )
{
OpenBuy();
AlowBuy=false ;
} // no more buy trades untilif ( BuyTrigger()==false )
{
AlowBuy=true ;
}
Keep Actions as functions and control as separate parts.
adityakhanna - in your own words could you desribe how the if ( condition ) action statement works? Also why does the if statment, RaptorUK mentions, would it do as you expect it to?
Sell : Above 80 RSI but it should come from below 50
not TP/SL but close above 20$ and Close below20$
Lot size : External
Means if we drag EA on chart and RSI is now 20 so dont buy but once rsi go to above 50 and comes again 20 then buy
same for sell condition suppose after TP/SL or new drag on chart if RSi is around 80 do not sell but it has come below 50 and then 80 so sell order placed
Every time above 50 and below 50 condition must be match.
One can write it but you wouldn't know if there was a logical error in the code or not only from the way it behaves. Which is why we ask you to understand the code you are looking at.
Break the problem down into separate parts. First concentratate on just the code and the conditions for the Buy.
You know the easy part.
1 check the syntax and parameters of the iRSI() technical indicater found in the documentation
double iRSI(
string symbol, int timeframe, int period, int applied_price, int shift)
2 fill the parameters in so you can read and undersand what its doing
4) by incrementing the shift value we can look at other past values of the RSI and test to see if it is following the pattern for entry.
or
4a) we can record the event in a static variable if ( iRSI(Symbol(),Period(),PIRCE_CLOSE,Shift)<50 && iRSI(Symbol(),Period(),PIRCE_CLOSE,Shift+1>50) ) Movebelow=true ;
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi Thanks for your reply
sorry for my late reply as i was not well.
the strategy is about rsi only
i need that rsi is above 85 then sell
abd below 20 buy order.
condition
if rsi is above 85 do not buy if it will around 60 to 85 range it should be buy only if this 85 comes after 30-45-60 and 85 sell not like 65-50-70-75-80-70-85 so not sell same for but also
not buy if RSIi is around 20 like 15-20-10-15-30-20-22 but buy if rsi is continue to go below like 70-60-40-20 then buy.
can you please make this EA for me
Edit - MyfirstEA and add the following control(s) concept as needed
Keep Actions as functions and control as separate parts.
Find code
now it is ok? i m trying this in forex ea generator with custom code but not succeed pls help
Find code
now it is ok? i m trying this in forex ea generator with custom code but not succeed pls help
If you can explain how this line of code males sense I'll help you.
it is for 5 digit broker to count pipvalue
that if not 5 digit than pip value is 10 other wise pipvalue is 1 (in 5 digit)
Ok Forget above code,
pls make EA based on this rule:
Buy: Below 20 RSI but it must come from above 50
Sell : Above 80 RSI but it should come from below 50
not TP/SL but close above 20$ and Close below20$
Lot size : External
Means if we drag EA on chart and RSI is now 20 so dont buy but once rsi go to above 50 and comes again 20 then buy
same for sell condition suppose after TP/SL or new drag on chart if RSi is around 80 do not sell but it has come below 50 and then 80 so sell order placed
Every time above 50 and below 50 condition must be match.
can you please make this EA for me
Thanks
Aditya Khanna
One can write it but you wouldn't know if there was a logical error in the code or not only from the way it behaves. Which is why we ask you to understand the code you are looking at.
Break the problem down into separate parts. First concentratate on just the code and the conditions for the Buy.
You know the easy part.
1 check the syntax and parameters of the iRSI() technical indicater found in the documentation
LastBarRSI = iRSI(Symbol(),Period(),PIRCE_CLOSE,Shift)
3 The final part of the Buy trigger will be
if(LastBarRSI<RSIEntryValue) SendBuy() ;
4) by incrementing the shift value we can look at other past values of the RSI and test to see if it is following the pattern for entry.
or
4a) we can record the event in a static variable if ( iRSI(Symbol(),Period(),PIRCE_CLOSE,Shift)<50 && iRSI(Symbol(),Period(),PIRCE_CLOSE,Shift+1>50) ) Movebelow=true ;