Forum

Closing a trade after a fixed length of time

I have an MQL4 EA that is a breakout system based on a time range. I want to optimize the entry. I order to do this I need to open a trade for a specific length of time, say 60 minutes. I am having a hard time finding a way to close a trade after it has been open for this fixed length of time. For

EA won't optimize in mt4 Strategy tester

I have an EA that is based on a time range breakout that I cannot get to optimize in the strategy tester . Is there any particular quality that would prevent optimization

Script won't execute

When I drag it to the chart it does everything it is supposed to do except execute buy on the chart. Live trading is checked . Script is attached. Please advise, thanks

Using this editor

Where can I find some documentation on how to use this editor? Like how to include code formatted correctly? Or can someone tell me? I'm beating my head against the wall over here and can't figure it out! Thanks

Referencing OP_BUYSTOP or OP_SELLSTOP once opened

My ea enters an OP_BUYSTOP and an OP_ENDSTOP and assigns the “OrderSend(Symbol(),,,,,,)”(s) to int variables for short and long. Can these orders be referenced to change the Stop Loss by the same variables once the price is hit and one of them is opened as a market order

Referencing OP_BUYSTOP once opened

I have to recognize , in this case, a long trade has been opened when a pending OP_BUYSTOP has been hit. It returns it to a variable nlongs. If nlongs is >0 and the price has moved x pips, the stop loss is moved to break even. int GetLongsNumber() { int n = 0 ; for ( int x = 0 ; x < OrdersTotal

Trade line not executed

I have alerts that display details of an executed trade once the trade line has been executed. Problem is, the alerts display but the trade is not executed. So the criteria for the trade is met an and the trade is not executed but the alert line is. This EA has worked in the past and the trade

Calculated Range variable as Int

I'm trying to convert a functioning time range breakout EA that works with fixed stop loss and take profit to one where these values are derived from the high and low of the time period. I tried "double range = High[h] - Low[l]" and subtracting and adding "range" to High[h] or Low[l] for stop loss

EA will not trade

I have an EA of a breakout strategy that no longer places trades. I stopped using it a year or so ago but changed the beginning and end times of the range which are both external variables. I have not changed the trading code since it ran successfully. Now it will trigger the Alerts in the code that

"Entering "Comments" on a manual trade"

How do I enter a comment on a manual trade executed through the keyboard directly on the platform so it will show up on the terminal? I want to document the particular method per trade that I enter manually. Thanks