
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
The trailing stops I'm programming these days are price delayed. If the TP is 40, then we might wait until 30 to have a trailing stop of 10. Then, I like sliding the TP up when the SL moves up, so the average price will go higher. I keep the TP around in case of disconnects or strange 1 tick spikes. (Keep the brokers a little honest!) PContour also had the idea of making the TS contracting, to the broker limit. Some brokers allow as close as 5 pip SL from current price, why leave the extra pips on the table? Sometimes the strategy makes sense to exit near the peak instead of trying to wait out the countertrend.
So here is my ideal Trailing Stop:
Delayed = wait until X pips in profit
Tight = under 15 pip trailing stop
Contracting = move the SL closer and closer to current price as time goes on
Sliding = move TP up when SL is moved
Even without "Contracting" the average profit is usually higher than TakeProfit each trade, instead of lower as with normal Trailing Stops. Without "Sliding" the average profit *must* be lower than the TakeProfit.Thanks very much Daraknor. It's a really nice strategy for trailing stop. I am still not sure how to integrate this type of trailing stop to my ea. But, I am going to try it. It looks good. By the way, is there any ea that use your method around here that I can have a look?
I tried this link https://www.mql5.com/en/forum/172924
But, I am not sure if one of them already used it.
Best regards,
Phoenix 5.7.3 uses the contracting property, Phoenix 6 Beta2 Advanced includes all properties except for contracting. www.forex-tsd.com/phoenix/ has downloads for both.
I should mention another property that isn't covered here: auto scaling. Rather than have the delay set to a fixed number of pips, I like to set the delay as a percentage of pips. For another EA I'm developing commercially that uses these techniques, 85% seems to be a solid consistent number regardless of currency, timeframe or TP.
Phoenix 5.7.3 uses the contracting property, Phoenix 6 Beta2 Advanced includes all properties except for contracting. www.forex-tsd.com/phoenix/ has downloads for both. I should mention another property that isn't covered here: auto scaling. Rather than have the delay set to a fixed number of pips, I like to set the delay as a percentage of pips. For another EA I'm developing commercially that uses these techniques, 85% seems to be a solid consistent number regardless of currency, timeframe or TP.
Phoenix 5.7.3 using contracting TS? I was testing it last time without realizing that
Thanks Daraknor. It's indeed a very nice idea to have such dynamic trailing stop. I'll have a look at 5.7.3 to see how it is done.
Btw, Phoenix 6 Beta2 has not been released right?
Best,
I am trying to get it to print the total # of lots used by the open orders. So far All I can get it the lot size of the last order.
Any body know how to get it to add the open orders lots together?
Heres what I have.
//////////// ////
if (OrderSelect( S_OpenOrders, SELECT_BY_POS,MODE_TRADES))
if (OrderSymbol( ) == Symbol())
{
if (OrderType() == OP_SELL && OrderMagicNumber( ) == ShortMagicNumber)
Print ("Short open orders lot usage=",OrderLots( ));
else
Print("OrderSelect returned error of ",GetLastError( ));
}
//////////// ///////// /////////
thanks
dave
More talk about Trailing Stops
I wish I knew how it affects the trade. I know now that the Trailing Stop triggers when its set amount is positive in profit then starts moving the SL closer to minimize loss but don't understand if we are in profit for the TS to kick in, why didn't our TP kick in and close the trade ?? I think it is good that if we are in profit even 1 pip to have TS move SL up as we get more in profit but what's the point in setting a TP if the trade is in profit and TS makes the trade vulnerable in hitting SL still?
setting
Heres this week mrspacman I started it on the 11th. Dave
hi, i am starting to forward test : do you use hedge and LScombined = false ?
thank in advance
giapel
I am trying to get it to print the total # of lots used by the open orders. So far All I can get it the lot size of the last order.
Any body know how to get it to add the open orders lots together?
Heres what I have.
//////////// ////
if (OrderSelect( S_OpenOrders, SELECT_BY_POS,MODE_TRADES))
if (OrderSymbol( ) == Symbol())
{
if (OrderType() == OP_SELL && OrderMagicNumber( ) == ShortMagicNumber)
Print ("Short open orders lot usage=",OrderLots( ));
else
Print("OrderSelect returned error of ",GetLastError( ));
}
//////////// ///////// /////////
thanks
davehi, david
this code gives total of lots used :
for(L_Count=0;L_Count<OrdersTotal();L_Count++)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber && OrderType() == OP_BUY)
{L_OpenOrders++;L_Profit=L_Profit+OrderProfit();L_Lots=L_Lots+OrderLots();}
}
giapel
hi, david
this code gives total of lots used :
for(L_Count=0;L_Count<OrdersTotal();L_Count++)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber && OrderType() == OP_BUY)
{L_OpenOrders++;L_Profit=L_Profit+OrderProfit();L_Lots=L_Lots+OrderLots();}
}
giapelcool thanks. What do I use to define L_Lots?
//////////// ////
for(L_Count=0;L_Count<OrdersTotal();L_Count++)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber && OrderType() == OP_BUY)
{L_OpenOrders++;L_Profit=L_Profit+OrderProfit();L_Lots=L_Lots+OrderLots();}
Print ("Short open orders lot usage=",OrderLots( ));
else
Print("OrderSelect returned error of ",GetLastError( ));
}
//////////// ///////// /////////
Dave
cool thanks. What do I use to define L_Lots?
//////////// ////
for(L_Count=0;L_Count<OrdersTotal();L_Count++)
{
OrderSelect(L_Count, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber() == LongMagicNumber && OrderType() == OP_BUY)
{L_OpenOrders++;L_Profit=L_Profit+OrderProfit();L_Lots=L_Lots+OrderLots();}
Print ("Short open orders lot usage=",OrderLots( ));
else
Print("OrderSelect returned error of ",GetLastError( ));
}
//////////// ///////// /////////
DaveL_Lots is a variable taht indicates lots for buy orders (on goblin edti....), and it is initialized to 0 before cycle.
when "for(L_Count... )" goes on L_lots is increased.
giapel
L_Lots is a variable taht indicates lots for buy orders (on goblin edti....), and it is initialized to 0 before cycle.
when "for(L_Count... )" goes on L_lots is increased.
giapelI wrote it in but I get L_Lots variable not defined. I tried adding L_Lots=0; above and still told me not defined. Tried, double (L_Lots=0); too.
Dave