Experts: ProfitTrailing

 

ProfitTrailing:

Realize virtual profit trailing.

Author: Hongliang Liu

 

some bugs found when run this EA in my real account,and fixed now but still under testing.the code has been uploaded again.

if there are any bugs,please kindly tell me to improve,thanks!

 
Is it applied to open positions or only new positions?
 
lugevho:
Is it applied to open positions or only new positions?
it's for opened positions,OP_BUY or OP_SELL orders
 

this is the latest version(20140717),fixed some bugs(i have upload to this forum,but not updated yet)

if there are any bugs,please kindly tell me to improve,thanks!

Files:
 
Hello, I have a question, but if I close the platform, I lose everything stored in the array of 'expert? and then if I open what happens?
thanks for the reply.
 
100watt:
Hello, I have a question, but if I close the platform, I lose everything stored in the array of 'expert? and then if I open what happens?
thanks for the reply.

as what you worry about,it's virtual profit trailing,which won't set the sl to platform server but just record in array.you can improve this EA to set the sl when the EA exit for risk management.

the array will be updated when u open the platform again.in fact,the array will be updated for every tick

thanks! 

 

100watt

Hello, I really appreciated your software ProfitTrailing, but, in my opinion, has a problem does not close stop loss orders in .I have activated the test section in the code and press me:

23:01:02.979 ProfitTrailing GBPUSD.ecn,M1: ProfitTrailing CheckForCloseOrder

0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57777118 openprice:120.377 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57775612 openprice:120.409 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57775473 openprice:120.387 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57775472 openprice:120.379 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57774518 openprice:120.373 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57774299 openprice:120.372 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57773738 openprice:120.346 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57773390 openprice:120.367 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57772706 openprice:120.348 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57772225 openprice:120.364 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57771964 openprice:120.363 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57771031 openprice:120.341 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57770495 openprice:120.378 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57770324 openprice:120.373 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57770031 openprice:120.373 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57769032 openprice:120.393 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57768151 openprice:120.407 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57764060 openprice:120.403 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57759794 openprice:120.428 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57759674 openprice:120.42 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57773139 openprice:1.21765 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57772222 openprice:1.2177 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57772009 openprice:1.21789 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57771947 openprice:1.21806 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57770539 openprice:1.21804 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57770037 openprice:1.2182 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57766739 openprice:1.21737 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57766518 openprice:1.21742 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57764170 openprice:1.21738 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57762710 openprice:1.21746 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57761995 openprice:1.21761 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57759728 openprice:1.21742 sl:-140523 tp:6.6
0 23:01:04.993 ProfitTrailing GBPUSD.ecn,M1: ticket:57648048 openprice:1.2196 sl:-140523 tp:6.6


all order in list is in loss from -17 € to -2 € it is normal ?

my setting is 
2014.12.28 23:06:41.486 ProfitTrailing GBPUSD.ecn,M1 inputs: minlots=0.1; minlotsprofittrailingsl=2.2; minlotsprofittp=3.3; slippage=1

tanks for raply ..

Hi.

this EA will set the virtual sl only if the profit exceeds the threshhold you set,to lock the profit and maximize the profit by virtual trailing. 

if you want to lock with little loss and trailing,just set minlotsprofittrailingsl with a minus value,eg. -2.2

thanks 

Reason: