mql4

How to draw a trend line that joins the highest point of every candle after first hour of day

泪湿孤枕 提交于 2019-12-11 04:16:14
问题 I want to write an EA that joins the highest points of each candle using a trend line (after the first hour of a day). I saw the documentation for the trend line. This is what I've done: ObjectCreate(chart_ID,name,OBJ_TREND,sub_window,time1,price1,time2,price2) ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style); ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width); ObjectSetInteger(chart_ID,name,OBJPROP_RAY,false); I know I am suppose to

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

Any MQL4 programmers? What is wrong with this code?

人盡茶涼 提交于 2019-12-10 11:58:00
问题 When I try to divide the two doubles in a buffer my indicator blacks out, and the values go extreme in the second window -90000000 and 90000000 #property indicator_separate_window // Îòîáðàæåíèå â îòäåëüíîì îêíå #property indicator_buffers 3 // Êîëè÷åñòâî áóôåðîâ #property indicator_color1 Red // Öâåò ïåðâîé ëèíèè #property indicator_color2 Blue // Öâåò âòîðîé ëèíèè #property indicator_color3 Green double FillBuffer[]; double DBuffer[]; double AverageBuffer[]; double H,L; double point=Point()

Why is my EA not moving my position to breakeven?

限于喜欢 提交于 2019-12-08 23:32:33
I'm attempting to modify my market orders to breakeven the position when the position get 100 pips to the good. This also accounts for the StopLevels which are around 20-30 pips for my broker. It checks the param's via a " for(){...} loop" function The MagicNumber is the timeframe number for the chart it is on (i.e. 240 =4H, 60 =1H) I don't set a TakeProfit price & initially no StopLoss price. The EA is not adding a SL to be equal to the opening price when the trade reaches 100 pip in profit (plus stoplevels). Profit points reaches well over 130 points. My code is below for a OP_SELL order -

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()

Fundamental data based trading algorithms

北城以北 提交于 2019-12-08 08:24:32
问题 Q1: Is it possible to create a script/algorithm that will purely place a BUY or SELL order of a selected currency pair, depending on whether e.g. an interest rate announcement is higher ( or lower ) than the forecast figure? I know many other technical and fundamental factors must be taken in to account before buying and selling financial instruments, but purely as an experiment I'd like to determine if this method is possible. If this can be achieved, Q2: how can an interest rate

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

Managing JSON Array format in MQL4 script

余生长醉 提交于 2019-12-07 23:18:37
问题 I would need to get data from inside a JSON Array. I use a call to WebRequest() function to get an order list from my db, thru a nodejs(api) and then I got the following JSON-data format e.g: [{"orderid": 123556, "ordertype": 0, "ordercurrency": "EURUSD", "orderdt": "2016-12-03 03:00:00" }, {"orderid": 123457, "ordertype": 0, "ordercurrency": "GBPUSD", "orderdt": "2016-12-03 03:15:00" } ] Any idea how to transform it to a normal array in order to manage data? Thank you. /Koul 回答1: JSON