metatrader4

How to check 3 RSI values against the Bollinger Bands?

喜夏-厌秋 提交于 2019-12-10 12:06:46
问题 There are Bollinger Bands with three RSI running in the basement. I want to do a check on the signal in such a way that when 3 RSI struck the zone of the upper Bbands, there was a signal down and vice versa: int start(){ double ma, stdev; int i, limit, count=IndicatorCounted(); if(count<0) return(0); limit=Bars-count; if(limit>1) limit=Bars-1; for(i=limit; i>=0; i--) { RSI[i] =iRSI(Symbol(),Period(),rsi_period, PRICE_CLOSE,i); RSI2[i]=iRSI(Symbol(),Period(),rsi_period_2,PRICE_CLOSE,i); RSI3[i

MT4 Trade Panel Lot Step

ぃ、小莉子 提交于 2019-12-08 13:02:41
问题 I need to write "Decrease & Increase" function code for "LOT_MINUS_LABEL". int OnInit() { ObjectCreate ( 0, "LOT_MINUS_LABEL", OBJ_LABEL, 0, 0, 0 ); } int OnChartEvent() { MarketInfo(Symbol, MODE_LOTSTEP); } 回答1: The GUI-Objects v/s MMI-Add-On-s in the MT4 Context: While MQL4 has evolved in several waves into a still creeping New - MQL4.56789 , there are some MetaTrader Terminal context, that has restrictions to keep in mind. After many years in pure-charting GUI, MetaQuotes Inc. has come

Email Notification when Expert Advisor fails to close a trading position

谁说我不能喝 提交于 2019-12-08 12:26:47
问题 I'm trying to develop a piece of MQL4 code which sends you a notification when an position opened by an Expert Advisor fails to close/liquidate when the conditions specified by the Expert Advisor are met. Here is what I have so far. The ClosePosition() returns true when the position is closed successfully and returns false when the EA fails to close the position. This is where the else if (ClosePosition == false) kicks in. //Order Close// string sym = Symbol(); int ordersTotal = OrdersTotal()

MQL4, Code layout for big EA

不羁的心 提交于 2019-12-08 07:47:04
问题 It is mostly a theoretical question ( but example code is always welcome ). The real question is: how to correctly code the 'frame' of an EA that tests multiple scenarios from multiple custom indicators? The way I'm ( busy ) building an EA, is not very much focused on 1 strategy, but is gonna try to 'test' multiple strategies and 'picks' the most appropriate one. So I have created a few custom indicators, that are all returning an array of 'status data'. For example I have the following

Interactions between Expert Advisor and Indicators on MQL4

十年热恋 提交于 2019-12-08 03:40:16
问题 Is it possible to read changes in pre-built indicator (for example: its value changes) through an expert-advisor, and of course - automate the trades based on those reads? What is the function that is responsible for doing this? I have tried to look this up on Google, but it appears I can only do things like track object creation or deletion ... called Chart Events.... maybe I'm missing something? 回答1: Yes, it is possible. MetaTrader4 Terminal is a software platform, that allows you to launch

Why MQL4 OrderModify() will not modify the order when backtesting?

烂漫一生 提交于 2019-12-08 02:15:18
问题 I'm trying to ADD a stop loss to my open market orders in MetaTrader 4 when a position gets 100 pips "to the good" which is to be equal to the Order Open Price; OrderStopLoss() == OrderOpenPrice() But this isn't happening. I've added Print() & GetLastError() functions and nothing is coming up in the journal, so it must be something in my coding - but cannot see what would be wrong. OK this is what I have so far, one for loop for the buy, one for the sell. I've also Normalized the "doubles" as

Why MQL4 OrderModify() will not modify the order when backtesting?

ぐ巨炮叔叔 提交于 2019-12-06 06:10:09
I'm trying to ADD a stop loss to my open market orders in MetaTrader 4 when a position gets 100 pips "to the good" which is to be equal to the Order Open Price; OrderStopLoss() == OrderOpenPrice() But this isn't happening. I've added Print() & GetLastError() functions and nothing is coming up in the journal, so it must be something in my coding - but cannot see what would be wrong. OK this is what I have so far, one for loop for the buy, one for the sell. I've also Normalized the "doubles" as I have been advised to do & have also declared the BuyMod & SellMod to "true" at the very top. This

How to read a JSON from a URL in MQL5?

*爱你&永不变心* 提交于 2019-12-05 07:40:22
问题 How can I read JSON from a url in MQL5 ? For example this simple JSON from: https://api.myjson.com/bins/56z28 { "employees": [ { "firstName": "John", "lastName": "Doe" }, { "firstName": "Anna", "lastName": "Smith" }, { "firstName": "Peter", "lastName": "Jones" } ] } 回答1: Simple, but restrictions apply. MetaTrader Terminal 5 is a code-execution environment, that can communicate with an external URL target (if explicitly configured as a permitted URL) via both HTTP/HTTPS protocols over port 80

How to keep a 10 pip profit gap between stop loss and current price as profits increase

巧了我就是萌 提交于 2019-12-04 21:35:32
问题 I am trying to add another condition to the solution in this post. I want the stop loss to move by 10 pips when a trade is in 10 pips profit. To be more specific, say I've set a pending buy order and the stop loss is 10 pips below the open price and the take profit is 50 pips. If the trade is 10 pips in profit, then the stop loss would move 10 pips upwards, if the trade moves to 20 pips in profit then the stop loss would move another 10 pips upwards, and the same would occur for 30 and 40

Can I use languages other than MQL4 on MetaTrader4?

元气小坏坏 提交于 2019-12-04 04:56:42
I have a task of migrating a C# market strategy to MetaTrader. Is there any way to automate that job? (For example, is it possible to parse C# into it's AST, then make the translation?) Does MetaTrader accept other languages by any means? Approach the task Bottom-Up -- Architecture-wise Yes, you can simplify the trouble and make MT4 become a Node, which is immediately connected peer-to-peer to your current C# Market Strategy. This alowed me to operate a cluster-based computing communicating massively parallel with a crowd of MT4 nodes. MT4 can become anEventFEED -er Node via a more complex "