Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1560
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
What do you want to get?
Do you have a code for mt4 to understand what you need?
double rsii1[100], rsii2[100],profit_m[100]; int b,s,b1,s1;
extern int rsi_shift=1;
extern intrsi_period1=4;
extern int rsi_period2=14;
extern int N=5;
extern int Level1=20;
extern int Level2=80;
extern int Level3=30;
extern int Level4=70;
int signal() // 3. Signal Function
{
int b = 0, s = 0, b1 = 0, s1 = 0; // Reset conditions
for (int i = 1; i <= N; i++) // Conditions over the last bars
{
rsii1[i] = iRSI(_Symbol, PERIOD_CURRENT, Inp_RSI_ma_period, PRICE_CLOSE, i);
rsii2[i] = iRSI(_Symbol, PERIOD_CURRENT, Inp_RSI_ma_period, PRICE_CLOSE, i);
if (rsii1[i] < Level1) b = 1;
if (rsii1[i] > Level2) s = 1;
if (rsii2[i] < Level3) b1 = 1;
if (rsii2[i] > Level4) s1 = 1;
}
double rsi1 = iRSI(_Symbol, PERIOD_CURRENT, rsi_period1, PRICE_CLOSE, rsi_shift);
double rsi2 = iRSI(_Symbol, PERIOD_CURRENT, rsi_period1, PRICE_CLOSE, rsi_shift + 1);
double rsi3 = iRSI(_Symbol, PERIOD_CURRENT, rsi_period2, PRICE_CLOSE, rsi_shift);
double rsi4 = iRSI(_Symbol, PERIOD_CURRENT, rsi_period2, PRICE_CLOSE, rsi_shift + 1);
if (rsi1 > rsi3 && rsi2 <= rsi4 && b == 1 && b1 == 1) return (ORDER_TYPE_BUY); //open buy
if (rsi1 < rsi3 && rsi2 >= rsi4 && s == 1 && s1 == 1) return (ORDER_TYPE_SELL); // open Sell
return(0);
}
I am trying to convert it to 5 by inserting a muving handle into the two rsi values.
The cross of RSI and MA above or below the specified levels
i.e. RSI above 70 and MA above 60 at cross from top to bottom opens short, and vice versa RS below and MA below at cross from bottom to top opens long.
I have a couple of dozens of such functions and I am trying to adapt them to 5. Some of them work, some of them don't.
H.Y. how do you hide the code area so that you don't get such sheets? I don't see the spoiler button so that I don't have to throw a thousand and a half lines on 5.0.
double rsii1[100], rsii2[100],profit_m[100]; int b,s,b1,s1;
H.Y. how do you hide the code area so that you don't get such sheets? I can't see the spoiler button so that I don't have to throw a thousand and a half lines on 5k.
Here I have finished something else, in idea it should close when receiving a profit in xxx amount
I want to change the condition to "if we have orders and they are of such type and they are in profit for the amount of OverProfit, then when receiving the opposite signal they close. Otherwise, our grid of orders averages the position by the amount of OverLoss/
. As I understand it is necessary to insert a memorable variable into the function of searching for signals and reset it after closing positions.
What is stressing me here - I have no idea how to work with these structures and take pieces from the database, so I edit by poke.
Hi there, I am new to mql5 but i have learned and created an advisor which gives "BREAK OF STRUCTURE" . It prints "BOS" when there is BOS found, it works fine and shows as object in strategy tester but i am not able to apply in real time chart. Please help.
EX5 removed by moderator.
iTime(0, PERIOD_M1, 0) ;
Maybe it's better to try this way
Checked. It is drawing something on the real time chart.
Maybe it's better to try it this way
PERIOD_CURRENT works fine, as soon as you put another TF, it says 1970.
On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)