please how do I code to check RSI value from when it is below 30(oversold) to when it goes above 30. I need it to replace this code "if(rsiValue > rsiLowerLevel && rsiValue < rsiUpperLevel)"... Below is my main code
In a RSI strategy with an entrance on 72 and 28, after the close of the trade how can add to the code a part that lock the second entrance if the price is already over 72?
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.
YES
//| RSI.mq4 |
//| Copyright © 2016, Хлыстов Владимир |
//| cmillion@narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, Хлыстов Владимир"
#property link "cmillion@narod.ru"
#property strict
#property description "советник по RSI"
#property description "sell при пересечение сверху вниз 70 и на buy снизу вверх 30"
#property description "стопы и тейки можно выстовить в настройках советника"
//--------------------------------------------------------------------
extern int period_RSI = 14,
stoploss = 100,
takeprofit = 200,
slippage = 10,
buy_level = 30,
sell_level = 70,
Magic = 777;
extern double Lot = 0.1;
//--------------------------------------------------------------------
void OnTick()
{
for (int i=0; i<OrdersTotal(); i++)
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if (OrderSymbol()==Symbol() && Magic==OrderMagicNumber()) return;
double RSI0 = iRSI(NULL,0,period_RSI,PRICE_OPEN,N);
double RSI1 = iRSI(NULL,0,period_RSI,PRICE_OPEN,N);
double SL=0,TP=0;
if (RSI0 > buy_level && RSI1 < buy_level)
{
if (takeprofit!=0) TP = NormalizeDouble(Ask + takeprofit*Point,Digits);
if (stoploss!=0) SL = NormalizeDouble(Ask - stoploss* Point,Digits);
if (OrderSend(Symbol(),OP_BUY, Lot,NormalizeDouble(Ask,Digits),slippage,SL,TP,NULL,Magic)==-1) Print(GetLastError());
}
if (RSI0 < sell_level && RSI1 > sell_level)
{
if (takeprofit!=0) TP = NormalizeDouble(Bid - takeprofit*Point,Digits);
if (stoploss!=0) SL = NormalizeDouble(Bid + stoploss* Point,Digits);
if (OrderSend(Symbol(),OP_SELL,Lot,NormalizeDouble(Bid,Digits),slippage,SL,TP,NULL,Magic)==-1) Print(GetLastError());
}
}
//--------------------------------------------------------------------
Great to replace 0 and 1 with N :)
But N is changing everytime on different charts and different currency pairs.
how to do we determine N between two RSI events in the code ?
Hello guys ,i need some help for coding:
i used RSI_Extremums_Sample indicator and double_smoothed_stochastic indicator in my expert .
but when i put in strategy tester don't work and my mt4 platform hanged . can anyone help me why is that ?
this is my code to get position :
i don't have any error in journal but test don't go forward and stop for hours ....
sorry about my poor english;
Hello guys ,i need some help for coding:
i used RSI_Extremums_Sample indicator and double_smoothed_stochastic indicator in my expert .
but when i put in strategy tester don't work and my mt4 platform hanged . can anyone help me why is that ?
this is my code to get position :
i don't have any error in journal but test don't go forward and stop for hours ....
sorry about my poor english;
You need this indicator ;
You need this indicator ;
i use this indicator and change code to this , but problem not solved , strategy tester don't movie
or
i tested two code but both of them have same problem.
i used RSI_Extremums_Sample indicator and double_smoothed_stochastic indicator in my expert .
but when i put in strategy tester don't work and my mt4 platform hanged . can anyone help me why is that ?
An amateur writes such a complicated program. Write a more comprehensible one.
Since "RSI_Extremums_Sample" calls "Cycle_KROUFR_version" with iCustom, these two and "double_smoothed_stochastic" are required.
It worked fine on my PC.
An amateur writes such a complicated program. Write a more comprehensible one.
Since "RSI_Extremums_Sample" calls "Cycle_KROUFR_version" with iCustom, these two and "double_smoothed_stochastic" are required.
It worked fine on my PC.
please how do I code to check RSI value from when it is below 30(oversold) to when it goes above 30. I need it to replace this code "if(rsiValue > rsiLowerLevel && rsiValue < rsiUpperLevel)"... Below is my main code
In a RSI strategy with an entrance on 72 and 28, after the close of the trade how can add to the code a part that lock the second entrance if the price is already over 72?