Does anyone know how I can get trailing stops with 5 and 10 pips? I heard there's an expert for it, but I can't find it. Thanks in advance
- trailing stops?
- Trailing Stop Loss
- Trailing Stop That runs off of Equity
Don't you just right click on the order, select Trailing Stop, choose Custom and type in the value you require ?
Don't you just right click on the order, select Trailing Stop, choose Custom and type in the value you require ?
Thanks for your reply. I can't choose e.g. 10 pips as it says that the minimal level is 15 pips.
this is imho an annoying 'feature' of MT4... training stops cannot be less than 15.. i really dont know why. anyway, here is some code i got from this forum... somewhere.. i have not changed it nor tested it.
//+------------------------------------------------------------------+ //| Trailing Stop 5.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; int init() { //---- TODO: Add your code here. //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int pos3pre = 1; int pos4cur = 0; int cnt = 0; int openpozprice = 0; int mode = 0; int deinit() { //---- TODO: Add your code here. //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { for (int i = 0; i < OrdersTotal(); i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY) { //if (Bid > (OrderValue(cnt,VAL_OPENPRICE) + TrailingStop * Point)) { // OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); // break; //} if (Bid - OrderOpenPrice() > TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) { if (OrderStopLoss() < Bid - TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT), OrderTakeProfit(), Red); } } } else if (OrderType() == OP_SELL) { if (OrderOpenPrice() - Ask > TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) { if ((OrderStopLoss() > Ask + TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT)) || (OrderStopLoss() == 0)) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + TrailingStop * MarketInfo(OrderSymbol(), MODE_POINT), OrderTakeProfit(), Red); } } } } //---- TODO: Add your code here. //---- return(0); } //+------------------------------------------------------------------+
Thanks alot hdb. Just one more thing, what does the 'lots' variable do? Argh I must learn MT4! hehe
it does nothing...
I have in the past run trailing stops of ten or less, obviously from my own expert, but with a minimum spread of 3 it doesn't really make sense.
I'd say 15 is the minimum you want to run at....
I'd say 15 is the minimum you want to run at....
I have in the past run trailing stops of ten or less, obviously from my own expert, but with a minimum spread of 3 it doesn't really make sense.
I'd say 15 is the minimum you want to run at....
I'd say 15 is the minimum you want to run at....
Anychance you could send me that expert? :)
Sorry.....no can do...
The code ,why I can't attach to a chart?
Forex Trader #:
The code ,why I can't attach to a chart?
If i may ask, are you saying if i code my own expert is there any chance that i can by pass the minimum allowable points and put my own custom points that are lower than the expected when i use a trailing stop manually.The code ,why I can't attach to a chart?
I trade indices specifically boom and crash on deriv
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register