TakeProfit not working intra bar

Posted By: Zheka

TakeProfit not working intra bar - 03/19/18 14:26

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..
Posted By: AndrewAMD

Re: TakeProfit not working intra bar - 03/19/18 15:14

Try adjusting TradeProfitLimit.
Posted By: Zheka

Re: TakeProfit not working intra bar - 03/19/18 15:51

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?
Posted By: AndrewAMD

Re: TakeProfit not working intra bar - 03/19/18 16:51

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.
Posted By: Zheka

Re: TakeProfit not working intra bar - 03/20/18 11:30

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.
Posted By: jcl

Re: TakeProfit not working intra bar - 03/21/18 12:49

I'll formulate that more clear in the manual.
© 2024 lite-C Forums