based on your nickname i assume you are german.
Maybe it's easier for you to explain it in german..
//z
i'm not sure what you mean.
as i understand it you want to:
switch Buy/Sell
Lay marketorder at InTime = 12:00
exit market at OutTime = 12:30
FixedStoploss = X pips
am i right?
exactly
Had some time over, consider it an early x-mas gift.
code does compile and runs, but thats it, no errorhandling or recover from expected shutdown.
Had some time over, consider it an early x-mas gift.
code does compile and runs, but thats it, no errorhandling or recover from expected shutdown.
ooh, just a typo, change:
if(Buy0_Sell1 == OP_SELL){ // OpenSell RefreshRates(); Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage*mt,Bid-Stoploss*pt,0,"TimeEA",MagicNumber,0,CLR_NONE); if(Ticket <= 0) Print("Error occured at open: ", GetLastError()); }
to:
if(Buy0_Sell1 == OP_SELL){ // OpenSell RefreshRates(); Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage*mt,Bid+Stoploss*pt,0,"TimeEA",MagicNumber,0,CLR_NONE); if(Ticket <= 0) Print("Error occured at open: ", GetLastError()); }
the only thing changed is the - sign to a +
Mql5 code:
bool CheckTime() { datetime tm=TimeCurrent(); string date =TimeToString(tm,TIME_DATE); //string str=TimeToString(tm,TIME_MINUTES); datetime _start= StringToTime(date+" "+Start+":00"); datetime _end= StringToTime(date+" "+End +":00"); Print("tm " + tm); Print("Start_time " + _start); Print("End_time "+ _end); if(_start<=tm && tm<=_end) return true; else return false; }
Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage*mt, Bid+Stoploss*pt,0,"TimeEA",MagicNumber,0,CLR_NONE);
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 -
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
thx much