This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
Trailing StopBack to topics list |
|
Peter
2004.11.29 23:35
Hello,
Could you please start Trailing Stop (TS) - 5 points, 10 points, 15...from your server. I can make my Expert Advisors program with Trailing Stop 5, but if i'm closing my computer Expert is not working. Who is using 300 points TS in Forex? How is working you TS? It is posible to make TS that after 5 pips will lock your profit? Thanks. Vlad TS Sample: //+------------------------------------------------------------------+ //| Trailing Stop Gen.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ extern double TakeProfit = 0; extern double StopLoss = 15; extern double Lots = 1; extern double TrailingStop = 5; double Points; int mode = 0; int init() { //---- TODO: Add your code here. //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int cnt = 0; int openpozprice=0; { //---- TODO: Add your code here. //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { int cnt=0, total; if(OrdersTotal()<1) { if(AccountFreeMargin()<(1000*Lots)) { Print("We do not have money"); return(0); } // check for trailing stop if(TrailingStop>0) { if (OrderType() == OP_BUY) { if(Bid-OrderOpenPrice()>Points*TrailingStop) { if(OrderStopLoss()<(Bid-Points*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Points*TrailingStop, OrderTakeProfit(),0,Red); return(0); } } } } return (0); if (OrderType() == OP_SELL) { if((OrderOpenPrice()-Ask)>(Points*TrailingStop)) { if(OrderStopLoss()==0.0 || OrderStopLoss()>(Ask+Points*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Points*TrailingStop, OrderTakeProfit(),0,Red); return(0); } } } } return(0); } // the end. //+-------------------------------------------------+ |
|
Slawa
2004.12.01 12:40
You've forgotten OrderSelect function call
|
|
Peter
2004.12.01 16:53
Thanks, Slawa.
Vlad What about your Trading station? Start from 5 pips...... |
|
Peter
2004.12.04 21:45
Asking...
Slawa, I thing you are not understand me about Trailing stop in your SERVER. We are brokers, working on commission and if we can get +5 points it is enough for us. Client is happy we are too. What I want to tell you: You have open position, you click right button on this position – show window- and there you have New Order Modify Order... Trailing Stop (TS) If you click TS appear a column with Trailing stops, starts from 15 pips to 300. Could you please start this “ladder” with 5 pips, 10 pips, 15…. Why? Because if I want to leave open position Over night, and I close my computer, Expert Adviser Is not working. I’m right???? Thanks Vlad |
|
Slawa
2004.12.06 11:12
we insert trailing stop 5 pips and what? such near stops are not allowed by server in any case.
expert advisors and trailing stops work on client computer. if your computer is turned off and does not work then your ts and expert advisors don't work too. btw "trailing stop" is predefined routine like expert advisor. |
|
Peter
2004.12.06 22:47
Sorry, I don’t understand you.
1)You have 2 Trailing Stop (TS), one is coming from Expert Adviser, second from your trading station. The Bought are the same? I expected that one is coming from Expert, second from your server. If I modify my open position, put S/L, T/P, After I’m closing a computer, these options are not working? In Refco trading station if you put stop and limit and Close your computer, server has these information And will close your position automatically. 2) In Trade (open position) you have 2 prices in menu. Which one is which? I know, First is open price, second Close price. Why you don’t put this name there? Thanks Vlad |
|
Slawa
2004.12.07 13:28
1 please do not mix trailing stop and stop loss! trailing stop from your computer modifies stop loss of opened order on server.
2 there are bid and ask prices |
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
