Auto Pending and Manage Orders by RSI - expert for MetaTrader 4
suggestion:
1. Set testmode true to backtest and false to real mode:
External boolean test mode = false ; //true: for backtesting
2. If it is test mode, please set only one of the tradesymbol arrays, for example:
External string trade symbol 1 = "EUR/USD m_802_2802_1602_200_860" ; External string trade symbol 2 = "" ; External string trade symbol 3 = "" ; External string trade symbol 4 = "" ; External string trade symbol 5 = "" ; External string trade symbol 6 = "" ;
If it is real account mode, set testmode false, and configure tradesymbol, etc. (use "," to separate symbols, use "_" to separate parameters of symbols):
External string trading symbol 1 = "EUR USD m_802_2802_1602_200_860, USD CHF m_506_2606_1506_120_600" ; External string trading symbol 2 = "USD JPY m_460_2802_1302_100_320" ; External string trading symbol 3 = "" ; External string trade symbol 4 = ”” ; External string trade symbol 5 = ”” ; External string trade symbol 6 = ”” ;
EURUSDm_802_2802_1602_200_860 means:
3. If you want to delete pending orders on the weekend, please set weekend delete=true, otherwise if you want to widen the gap between pending orders and restore them next week, please set weekend delete=false.
External Boolean value weekend delete = wrong ; //true: delete false: modify
4. Weekend mode start and end time (5 means Friday, 7 means Sunday (the time is GMT, it may need to be adjusted according to local time, the default parameters work well in Beijing time):
//Friday trading end time outer integer weekend start = 5 ; outer string weekend start time = "20:30" ; //Friday 20:30 outer integer weekend = 7 ; outer string weekend end time = "23:30" ; //Sunday 20:30
5. All symbols (maybe not trade symbols) you want to have RSI value alerts mailed (>70 or <30) and reported to you regularly. Obviously, if your account is not a mini account, you should modify AUDJPYm.
String symbol str1 = “AUDJPYm, AUDCADm, AUDCHFm, AUDNZDm, AUDSGDm, AUDUSDm, CADCHFm, CADHKDm, CADJPYm, CHFJPYm, CHFPLNm , CHFSGDm, EURAUDm, EURBRLm, EURCADm, EURCHFm, EURDKKm, EURGBPm, EURHKDm, EURHUFm, EURJPYm, EURMXNm” ; String symbol str2 = "GBPCHFm, GBPJPYm, GBPNZDm, GBPUSDm, HKDJPYm, HUFJPYm, MXNJPYm, NZDCADm, NZDCHFm, NZDJPYm, NZDSGDm , NZDUSDm, SGDJPYm, USDBRLm, USDCADm, USDCHFm, USDCZKm, USDDKKm, USDHKDm, USDHUFm, USDJPYm, USDMXNm” ; String symbol str3 = “EURNOKm, EURNZDm, EURPLNm, EURRUBm, EURSEKm, EURSGDm, EURTRYm, EURUSDm, EURZARm, GBPAUDm, GBPCADm ,USDNOKm,USDPLNm,USDRONm,USDRUBm,USDSEKm,USDSGDm,USDTRYm,USDZARm,XAGUSDm,XAUUSDm,ZARJPYm” ; Long sending minimum interval = 3600 ;
6.RSI configuration:
//RSI external integer rsi time frame = PERIOD_H4 ; external integer rsi period = 14 ; external ENUM_APPLIED_PRICE rsi applied price = PRICE_CLOSE ; external integer rsi offset = 0 ; external double rsi upper line = 70 ; external double rsi lower line = 30 ;
7. Use magicweekendexpiration to identify weekend patterns, if anyone has a better method please tell me
Integer magic weekend expiration = 1577836800 ; //2020-1-1 0:0:0 int value: 1577836800
8. Others:
If modifying the weekend mode fails, the EA will send an email and try MAX_MODIFY_TRY_TIME (default 100) times until successful.
Stop loss is not applied, and if a small loss order (minimum buy or maximum sell order) for one symbol exceeds the suspension point, the EA will suspend another order for the same symbol.
In test mode, if the equity is lower than 95% of the balance, the EA will write the status to the warning file.
If (((Account Equity()/Account Balance()) < 0.95 )) { WriteToWarningFile(); }
If you find any bugs or have suggestions please let me know.
Attachment download
📎 autopendingbyrsi.mq4 (45.52 KB)
Source: MQL5 #11684
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •