Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, howardR, sleakz), 674 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
TakeProfit not working intra bar #471763
03/19/18 14:26
03/19/18 14:26
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
Hello All,

I have found that:

1) re-calculating/ re-setting a global TakeProfit variable does not change the TP for the trade.
The trade is closed at the TakeProfit value set at the time of trade opening.

2) Trying to exit trades with exitLong(0,-TP) does NOT close trades correctly, even if the limit price had been penetrated intrabar (high>Limit) (but when close of the bar did not reach the target)

The above is experienced when calling all entry/exit functions at Frame end, with or without TICKS set.

I would expect that in [Test] mode trades will be closed on TP target regardless of these 2 nuances.

How are take profits handled? How to make this work correctly?
I did not experiment with a TMF; exitLong(0,-TP) is supposed to work..

Re: TakeProfit not working intra bar [Re: Zheka] #471767
03/19/18 15:14
03/19/18 15:14
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Try adjusting TradeProfitLimit.

Re: TakeProfit not working intra bar [Re: AndrewAMD] #471769
03/19/18 15:51
03/19/18 15:51
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
Thank you, Andrew! This works.

Looking at the more detailed log, I can see that exitLong(0,-TP)- where TP is price distance- determines the limit level relative to the current price(!), not TradePriceOpen.

This is not reasonable/practical/expected at all. (while the manual does not explicitly state this detail).

Is this how it really is supposed to work?

Re: TakeProfit not working intra bar [Re: Zheka] #471777
03/19/18 16:51
03/19/18 16:51
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Quote:
price: Optional price or price distance for selling the position, or 0 for selling at market. A positive price or price distance constitutes an exit stop, a negative price is an exit limit (similar to Entry). An exit stop closes the position when the asset price is at or worse than the given price, like a stop loss; an exit limit closes the position when the asset price is at or better than the given price, like a profit target.
It is a little vague, but it seems that the value is relative to market price. This interpretation is consistent because price=0 means exit at market.

Re: TakeProfit not working intra bar [Re: AndrewAMD] #471811
03/20/18 11:30
03/20/18 11:30
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
It does appear consistent..But then it means it is just for micro-managing a trade, as the order (in a typical case) can only be triggered on the next bar..

JCL,
would appreciate your comments.

Re: TakeProfit not working intra bar [Re: Zheka] #471826
03/21/18 12:49
03/21/18 12:49
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
I'll formulate that more clear in the manual.


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