mt4

How to get price of Chart HLine objects and calculate Fibonacci levels

只愿长相守 提交于 2019-12-11 04:49:07
问题 Three part question: How to find 2 user created horizontal lines on a chart by name and return the price of each. Then determine which HLine was crossed by the price most recently to determine trend direction. Calculate Fibonacci levels based on prices and direction 回答1: Working example of Fibonacci object that can be edited by the user and printing of fibonacci levels. #include <ChartObjects/ChartObjectsFibo.mqh> CChartObjectFibo *Fibo; int OnInit() { Fibo = new CChartObjectFibo(); #Create

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

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 can I write mql4 code (EA) that marks the listed candle patterns with rectangles

混江龙づ霸主 提交于 2019-12-03 11:45:12
问题 I am quite new to writing mql4 code and would be grateful if I could get some help drawing rectangles when the following candlestick patterns occur: FIG1: Run code snippet <blockquote class="imgur-embed-pub" lang="en" data-id="a/fRoPzsm"><a href="//imgur.com/a/fRoPzsm">Demand Zone 1</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> FIG2: Run code snippet <blockquote class="imgur-embed-pub" lang="en" data-id="a/4E8KE1R" data-context="false"><a href="/

外汇MT4编程手册

房东的猫 提交于 2019-12-01 07:59:12
1、为了最大的方便用户,交易中断的一些变量可以从智能系统输入。 AccountNumber -- 账号(同义词:AccNum) ASK -- 卖价 (买方出价) Balance -- 交易账户的余额值 Bars -- 图标上条形的数目 -- 说明用数据填充图表程度的非常重要的一个变量 Bid -- 买入价(卖方要价) Open -- 开盘价 Close -- 收盘价格 High -- 期间最高价位 Low -- 期间最低价位 Credit -- 信用优先 Equity -- 账户状况,包括未实现利润 FreeMargin -- 交易账户的自由保证金值 -- 也用来核查账户资金的可用性 Margin -- 用来支撑开仓部位的资金(保证金) Point -- 当前金融工具单点上的价值(此点此时智能交易系统系统运行),比如,USD/JPY -- 0.01,USD/CHF -- 0.0001 等 PriceAsk -- 在市场观测窗口上显示的当前卖价 PriceBId -- 在市场观测窗口上显示的当前买价 PriceHigh -- 当前24小时期间的最高买价 PriceLow -- 当前24小时期间的最高卖价 PriceTime -- 在当前观测窗口上显示的当前时间 Time -- 价格图表上的条形时间的基准时间 TotalTrades -- 开仓部位的总数和交易中断上的延迟订单