trading on weekends

Back to topics list To post a new topic, please log in or register
avatar
12
lukasjob 2016.08.03 15:05
 

Hi everyone,

what happens if my ea opens a position (with a stop loss) on friday and it's still open after the broker shuts the service?

From friday 10pm to monday morning my metatrader chart is dead, is it ok if my position is still open or should I close it before 10pm?

Thank you.

Luca


avatar
4
mf456 2016.08.03 15:29 #
 

That rather depends on how sophisticated your EA is. In reality, your position will be held over the weekend and will still be there when the market re-opens the following week. Whether your EA still knows about it depends on several factors, including whether or not you shut MetaTrader down over the weekend, whether or not your EA is equipped to tell by looking at open positions whether or not it has a position it is supposed to be managing, and whether or not your EA contains any code to keep track of what it is doing when it is shut down and restarted.


All EAs I code for other people or for deployment live contain code to store their internal state so they can recover if they are shut down, either due to an MT crash, or weekend maintenance. But that doesn't happen automatically; if the person who your your EA didn't put it in, it doesn't have it.

avatar
12
lukasjob 2016.08.03 15:58 #
 
mf456:

That rather depends on how sophisticated your EA is. In reality, your position will be held over the weekend and will still be there when the market re-opens the following week. Whether your EA still knows about it depends on several factors, including whether or not you shut MetaTrader down over the weekend, whether or not your EA is equipped to tell by looking at open positions whether or not it has a position it is supposed to be managing, and whether or not your EA contains any code to keep track of what it is doing when it is shut down and restarted.


All EAs I code for other people or for deployment live contain code to store their internal state so they can recover if they are shut down, either due to an MT crash, or weekend maintenance. But that doesn't happen automatically; if the person who your your EA didn't put it in, it doesn't have it.

I coded my ea, metatrader is always on during weekends (it runs on a vps), the ea doesn't close any order just sets tp and sl, I wonder if that is safe over weekends I mean since the position is open on the broker server if the price reaches the stop loss on saturday will the order be closed?

(I don't have any mechanism for shutdown recovery, it's very tedious to code that stuff, I have a lot of parameters in many ea's on the same mt4 client).

avatar
12985
WHRoeder 2016.08.03 16:08 #
 
lukasjob: what happens if my ea opens a position (with a stop loss) on friday and it's still open after the broker shuts the service?  From friday 10pm to monday morning my metatrader chart is dead, is it ok if my position is still open or should I close it before 10pm?
mf456: if the person who your your EA didn't put it in, it doesn't have it.
  1. Market is open Sunday 5PM Eastern time (EST|EDT) and closes Friday 5PM. (Some brokers open later and close earlier do to low volatility.)
  2. "What happens?" Nothing, you stop getting ticks. The order is on the server.
  3. "should you?" Executive decision but market can gap on the open (one Gap was 200 pips!) If you're trading smaller timeframes, can your account handle a 200 pip loss?
  4. EA's must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a OrderSelect loop to recover, or persistent storage (GV+flush/file) of ticket numbers required.
avatar
12
lukasjob 2016.08.03 16:39 #
 
WHRoeder:
  1. Market is open Sunday 5PM Eastern time (EST|EDT) and closes Friday 5PM. (Some brokers open later and close earlier do to low volatility.)
  2. "What happens?" Nothing, you stop getting ticks. The order is on the server.
  3. "should you?" Executive decision but market can gap on the open (one Gap was 200 pips!) If you're trading smaller timeframes, can your account handle a 200 pip loss?
  4. EA's must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a OrderSelect loop to recover, or persistent storage (GV+flush/file) of ticket numbers required.

Ok, I understand my ea will lose control of a trade is there's a crash, but if the order was open with a stop loss I guess the position will be closed if the price reaches the stoploss level even in case of a a crash or if it's saturday and my terminal is dead. So I can lose only by a stoploss amount, is that right? I'm scared by your 200 pips example, again if my stoploss is at 40 pips why 200?


I don't store any ticket number in a variable but always call OrdersTotal/OrderSelect to retrieve the last position from the server (I allow only one open position per ea).


avatar
12985
WHRoeder 2016.08.03 20:15 #
 
lukasjob: can lose only by a stoploss amount, is that right? I'm scared by your 200 pips example, again if my stoploss is at 40 pips why 200?
No. A stop loss becomes a market order when hit. If the market gaps, that is where the order will be closed.
avatar
12
lukasjob 2016.08.04 11:09 #
 
WHRoeder:
No. A stop loss becomes a market order when hit. If the market gaps, that is where the order will be closed.

Thanks for you reply.

That's a bummer. I can't afford to let a position open over the weekend, I gotta close 'em all before the weekend starts then.

I wonder how people manage to let positions open over a long period of time like days or weeks.

By the way, it's so difficult to find good reliable information on this topic, I guess all we have is the mt4 book/reference on the website, is there anything else?

avatar
108
eddie 2016.08.04 12:08 #
 

Don't mix up MetaTrader and EA programming with trading and the market.

You don't find detailed informations how the market works and how to trade on this forum.

Back to topics list  

To add comments, please log in or register