Taking partial profit in Zorro

Posted By: Diabolus

Taking partial profit in Zorro - 01/04/21 23:53

Hey folks,

I'm trying to redo strategies I already have in MT5 in Zorro to learn. Also, this way I'd be able to run them side by side to see if the outcome is "the same" (or close enough).

I'm looking for ways to enter with multiple lots and take partial profits with Zorro on price levels that are defined at entry time, but couldn't find a way to do that. I already looked at TrailLock (not exactly what I want), and exitLong (couldnt find a way to make it work).

I only found 2 ways of taking profits this:
  • if a condition is met, exitLong - This isn't perfect as the level is not always correct, it is only based on conditions that may give me variable levels (I'm trying to set exactly as R% for my partial profits)
  • exit the full position by setting the profittarget in enterLong.


I'm trying to implement something like this:
EntryLong - Stop Entry on High of last bar with 2 lots. (done)
Once in a position set Stop as Low of signal bar (done)
As soon as I enter in a position I set a partial profit of 1 lot at 1R with a limit order (the same distance from entry to initial stop) - (Missing)
When this partial profit is reached, set stop for the remaining position (1 lot) at breakeven (entry price) - (Missing)

TrailStop through a Lower of the last 3 bars - (done)


I searched the forum and manual, but there doesn't seem to be a function like in MT5 (PositionClosePartial). I'd appreciate any assistance.
Posted By: MatPed

Re: Taking partial profit in Zorro - 01/05/21 09:56

Hi, I do not know if I correctly understood, but yo can do it in many ways:
Open 2 trades with half of the size and set the take profit accordingly
Set trailing accordingly with your calculation
Code a TMF that make all the calculation you want and close half of the position

Ciao
Posted By: Diabolus

Re: Taking partial profit in Zorro - 01/08/21 00:36

For some reason, I tried doing it this way (initiating 2 trades) but it gets crazy, maybe I'm missing some logic there.

I've done it with TMF but unfortunately the way I've done it, I check if a candle closed above the supposed take profit position and then close that position. But this is not exactly what I need, as sometimes the price will touch that point but close the candle below it.

In any case, I appreciate the response.
Posted By: MatPed

Re: Taking partial profit in Zorro - 01/09/21 09:51

TMF executes every ticks, if you set the TICKS flag. If correctly coded it will close at the exact level required, slippage excluded obviosly
© 2024 lite-C Forums