Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Quad, VoroneTZ, 1 invisible), 623 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Locking Profit #456050
11/07/15 08:47
11/07/15 08:47
Joined: Mar 2015
Posts: 336
Rogaland
N
nanotir Offline OP
Senior Member
nanotir  Offline OP
Senior Member
N

Joined: Mar 2015
Posts: 336
Rogaland
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?

Re: Locking Profit [Re: nanotir] #456081
11/09/15 00:46
11/09/15 00:46
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Easy - adjust the stop level using a TMF when profit reaches your desired level.

Re: Locking Profit [Re: boatman] #456091
11/09/15 07:47
11/09/15 07:47
Joined: Mar 2015
Posts: 336
Rogaland
N
nanotir Offline OP
Senior Member
nanotir  Offline OP
Senior Member
N

Joined: Mar 2015
Posts: 336
Rogaland

Thanks. I will try to.
Something like:

Click to reveal..
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 ?

Re: Locking Profit [Re: nanotir] #478028
08/27/19 19:48
08/27/19 19:48
Joined: Jul 2019
Posts: 26
M
maxwellreturn Offline
Newbie
maxwellreturn  Offline
Newbie
M

Joined: Jul 2019
Posts: 26
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;
}

Re: Locking Profit [Re: nanotir] #478455
10/24/19 01:48
10/24/19 01:48
Joined: Aug 2019
Posts: 22
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 22
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?

Re: Locking Profit [Re: nanotir] #478461
10/24/19 09:20
10/24/19 09:20
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Unrelated to TradePriceClose, your if() condition is never true. Read here why:
https://manual.zorro-project.com/comparisions.htm


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1