Posted By: nanotir
Locking Profit - 11/07/15 08:47
Hi
I want to lock the profit once it achieve a certain price level. But before this I do not want to trail in any way. I have tried many different ways but I can code it properly.
Any ideas?
Posted By: boatman
Re: Locking Profit - 11/09/15 00:46
Easy - adjust the stop level using a TMF when profit reaches your desired level.
Posted By: nanotir
Re: Locking Profit - 11/09/15 07:47
Thanks. I will try to.
Something like:
int lock()
{
if( TradeIsOpen and TradePriceClose==Level )
TradeStopLimit = Level;
return 0;
}
What about using TradeTrailLock from that level if I did not define any trailing before? Is it enough just by writing Trail=0 ?
hey guys why if i use this TMF function for profit lock, nothing happen? where i am wrong? thank you
int lock()
{
if( TradeIsOpen && TradePriceClose==TradePriceOpen+30*PIP )
TradeStopLimit = TradePriceOpen+10*PIP;
plot("Stop",TradeStopLimit,MAIN,BLACK);
return 0;
}
Posted By: felixfx
Re: Locking Profit - 10/24/19 01:48
I think there may be a logic flaw in if(TradePriceClose). TradePriceClose is literally the price in which the trade itself closed, so why would the closing of the trade generate a new stop for a trade that has already closed?
Posted By: jcl
Re: Locking Profit - 10/24/19 09:20
Unrelated to TradePriceClose, your if() condition is never true. Read here why:
https://manual.zorro-project.com/comparisions.htm